Computer system having audio/video/CD drive controller/coprocessor having integral memory interface, graphics coprocessor, digital signal processor, compact disk controller, and video controller

ABSTRACT

A computer system for high-performance video and audio manipulations comprising a locked memory cartridge and an audio/video/compact disk (CD) drive controller/coprocessor. The computer system has a central processing unit (CPU) with at least one bus associated therewith, with the bus having at least one bus line. The cartridge comprises a readable memory, a memory control circuit, a lock control circuit, and a connector all in circuit communication with each other. The connector allows the memory, the memory control circuit, and the lock control circuit to be pluggably connected in circuit communication with the CPU. The memory control circuit scrambles some of the bus lines, thereby scrambling the data in the memory on reset, and unscrambles the bus lines responsive to inputs from the lock control circuit. The lock control circuit monitors the bus, waiting for a proper combination of bus values to be asserted onto the bus, at which time the lock control circuit causes the memory control circuit to unscramble the bus lines. The audio/video/CD drive controller/coprocessor comprises a CPU interface, a CPU cache, a memory controller, a memory bus arbitrator, a DRAM refresher, a video controller, a CD drive controller, a digital signal processor (DSP) sound coprocessor, and a &#34;blitter&#34; graphics coprocessor in an integrated package.

RELATED APPLICATION

This application is a continuation of application Ser. No. 168,675 filed16 Dec. 1993 and entitled "Protected Programmable Memory Cartridge andComputer System Using Same", now U.S. Pat. No. 5,666,516.

FIELD OF THE INVENTION

The present invention relates generally to computer system architectureand, more specifically, to a computer system having a removableprogrammable memory cartridge with an address-scrambling protectioncircuit to prevent unauthorized cartridges from being used in thecomputer system and to prevent use of the cartridge in unauthorizedsystems.

BACKGROUND OF THE INVENTION

Video graphics computer systems are well known, popular consumerproducts. A typical system includes a data processing unit that connectsto an ordinary television set for displaying images of a game or otherapplication. The data processing unit receives controlling software froma read only memory (ROM) that is usually packaged in the form of acartridge. The cartridge is removably plugged into the data processingunit. At least one pointing device, such as a mouse, joystick, touchpad,switch pad, or light gun, is also connected to the data processing unitto allow the player to input positional information that is used by thecontrolling software to execute the application.

The data processing unit typically has a single central processing unit(CPU) and associated volatile and non-volatile memory, including allrandom access memory (RAM) and bootstrap read-only memory (boot ROM), atelevision (RF video) signal generator, and an input/output (I/O)processor to interface to the various pointing devices. These devicesare in circuit communication. One distinguishing characteristic of thesesystems is the use of a motherboard or system planar to electricallyconnect these components together.

In such computer systems, the components communicate via electricalsignals; therefore, many components must be in electrical circuitcommunication to allow the signals to pass from component to component.These electrical signals are typically carried by electrical connectionsbetween the system components. Typical types of electrical connectionsinclude metal traces on a printed circuit board (PCB), vias betweendifferent levels of multilayer PCBs, plated through holes, plugs, andindividual wires connected from pin to pin of system components.Typically groups of electrical signals and groups of electricalconnections that carry the electrical signals are referred to as a"bus." Thus, a reference to a "bus" can indicate a reference to a groupof electrical signals, a group of electrical connections that carry theelectrical signals, or a reference to both a group of electrical signalsand a group of electrical connections that carry the electrical signals.

Buses are typically made up of "bus lines." A reference to an individual"bus line" may refer to an electrical connection of a bus or anelectrical signal of a bus. The memory in computer systems is broken upinto small sections called "bytes." Each byte in memory has a unique"address," similar to the unique addresses of personal residences. Theinformation stored in memory is called "data." A computer systemtypically has three buses: an ADDRESS bus, a DATA bus, and a CONTROLbus. When a computer reads a piece of information from a particularaddress in memory, the CPU asserts the address of that particular pointin memory onto the ADDRESS bus, then the CPU communicates to the memorychip to that the CPU desires to access the information stored in thataddress using the CONTROL bus. Then the memory chip asserts theinformation stored at that location onto the DATA bus. Finally, the CPUreads the data from the DATA bus. The above process is very fast,occurring at up to millions of times per second.

In typical cartridge-based systems, the ADDRESS bus, the DATA bus, andthe CONTROL bus are extended out of the data processing unit through theconnector to the electrical devices within the cartridge. Thus, whilethe cartridge is connected to the data processing unit, the program ROMin the cartridge is as much in electrical circuit communication with theCPU as is the bootstrap ROM and the system RAM within the dataprocessing unit.

The commercial success of such systems motivates other, nonmanufacturingparties to design and manufacture competing cartridges and competingdata processing units. The unauthorized cartridges are capable ofexecuting in authorized data processing units; likewise, theunauthorized data processing units are capable of executing the programscontained within authorized cartridges. Such competing devices are notalways "fully compatible" with authentic devices; therefore,unauthorized devices might malfunction. Moreover, incompatibilities insuch unauthorized devices might cause the authorized devices tomalfunction, thereby tarnishing the image of entities that manufactureauthorized cartridges and authorized data processing units.

Moreover, authentic devices are typically designed and marketed toexecute programs that are somewhat sophisticated in design and polishedin execution. Allowing others to market programs or data processingunits lacking similar sophistication and quality further tarnishes theimage of entities manufacturing authorized cartridges and authorizeddata processing unitsThus, in cartridge-based computer systems it isdesirable to prevent two types of unauthorized use: (1) the use of anunauthorized cartridge in an authorized processor unit and (2) the useof an authorized cartridge in an unauthorized processor unit. Thus, itis desirable to have the capability of authenticating a cartridge foruse in a data processing unit and preventing unauthorized use ofcartridges. Typical prior art devices do not provide a cost-effective,satisfactory solution to the problem.

An example of one such prior art system is found in U.S. Pat. No.4,799,635 issued to Nakagawa on Jan. 24, 1989, which is directed to anauthentication technique for a cartridge-based game unit.Software-controlled microprocessors exist in each of the data processingunit and the cartridge for executing related algorithms whose resultsare then compared. When a cartridge is inserted into the data processingunit, a satisfactory comparison must be made before the game unit willaccept and operate with the cartridge. This approach is rathercomplicated and adds to the cost of manufacturing the cartridge, becausea microcontroller must be added to the cartridge design.

Therefore it is desirable to provide a simpler security circuit for aROM cartridge that causes a host data processing unit to only acceptauthentic cartridges and that prevents use of an authentic cartridge inunauthorized systems.

In addition, typical prior art systems have a single system bus forpassing data among the various components. Having only one system busreduces system performance because all I/O devices depend on the CPU formemory accesses. Moreover, typical systems do not provide an integratedsolution to handling high-performance video, graphics, and soundproblems.

SUMMARY OF THE INVENTION

According to the present invention, a program cartridge is provided withan address scrambler and lock control circuit interposed between the CPUand the program ROM within the cartridge. When the system is powered up,the address scrambler "locks" the cartridge, preventing data from beingaccessed. The data processing unit "unlocks" the program cartridge bycommunicating a "combination" to the lock control circuit, which causesthe address scrambler to "unlock" the program cartridge.

The address scrambler locks the cartridge by scrambling the addresslines of the ADDRESS bus between the CPU and the ROM in the cartridge.When the address lines are scrambled, the CPU can still access thememory locations in the ROM; however, the data in memory will appear tobe in the wrong address in memory. Therefore, the CPU cannot executeprograms from the ROM in the cartridge while the address scrambler isscrambling the address lines. Thus, the cartridge is "locked."

To "unlock" the cartridge, the CPU asserts a predetermined sequence ofaddresses onto the ADDRESS bus. The assertions are merelymemory-to-register operations because the program ROM is scrambled,thereby preventing actual execution of the code in the program ROM. Anyattempt to execute code within the ROM will cause a system crash becausetypical instructions are multi-byte instructions and scrambling theorder of bytes causes the instructions to be executed incorrectly.

The sequence of addresses acts as the "combination" to unlock thecartridge. The lock control circuit monitors the ADDRESS bus, waitingfor the correct "combination" to be written to the ADDRESS bus by theCPU. Once the lock control circuit detects the correct sequence ofaddresses, the lock control circuit causes the address scrambler to stopscrambling the address lines between the ROM and the CPU. With theaddress lines no longer scrambled, the CPU may execute programs from theROM in the cartridge. The cartridge is "unlocked."

Adding the address scrambler and the lock control circuit to thecartridge adds little or no cost to the cartridge. In addition to theROM, typical prior art cartridges have a programmable logic chip insidecalled an "address decoder," which is very well known in the art.Typical programmable logic chips have enough capacity to implement theaddress decoder as well as the address scrambler and lock controlcircuit of the present invention. Thus, the present invention may beadded to cartridges without adding any additional chips, thereby addingthe functions at little or no additional cost.

It is therefore an advantage of the present invention to provide a verycost-effective way of preventing unauthorized uses of the cartridges anddata processing units.

In addition to the locked cartridge, the present invention also makesuse of a massive custom chip to perform many tasks necessary toimplement a high-speed, high-resolution audio/video system. This chipincludes an interface to the CPU, a CPU "cache," a memory controller, amemory arbitrator, a DRAM refresher, a video controller, a compact disk(CD) drive controller, a digital signal processor (DSP) soundcoprocessor, and a "blitter" graphics coprocessor. With the use of this"audio/video/CD controller/coprocessor" (A/V/CD controller/coprocessor),a very high-speed, high resolution system becomes very cost-effective.The entire data processing system includes a CPU, the A/V/CDcontroller/coprocessor, memory, a TV signal generation circuit, an I/Oprocessor, two decoder programmable array logic devices (decode PALs),two cartridge connectors, and an expansion connector.

The A/V/CD controller/coprocessor generates a second system bus (SYSTEM'bus) from the SYSTEM bus generated by the CPU. The system memory(including video RAM, system RAM, and boot ROM) is interfaced via theSYSTEM' bus. The cartridge ROM is interfaced via the SYSTEM bus;moreover, the processor "cache" is interfaced via the SYSTEM bus. Thusthe CPU can access the cartridge ROM and the "cache" while the A/V/CDcontroller/coprocessor performs functions with the system memory,thereby allowing parallel operation of the CPU and the A/V/CDcontroller/coprocessor.

Thus, it is a further advantage of this invention to provide aseveral-chip solution to designing a high-speed, high-resolutioncomputer system.

These and other advantages of the present invention shall become moreapparent from a detailed description of the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

In the accompanying drawings, which are incorporated in and constitute apart of this specification, embodiments of the invention areillustrated, which, together with a general description of the inventiongiven above, and the detailed description given below serve to examplethe principles of this invention.

FIGS. 1A and 1B are block diagrams showing the general layout of thesystem of the present invention;

FIG. 2 is an electrical schematic representation of a portion of thevideo digital-to-analog converter used in the present invention;

FIG. 3 is a schematic representation of one implementation of theaddress scrambler of the present invention;

FIG. 4 is a block diagram showing the audio/video/CDcontroller/coprocessor of the present invention;

FIG. 5 is a block diagram showing an alternate circuit for "locking" aprogram cartridge; and

FIG. 6 shows a memory map of a third alternative for "locking" a programcartridge.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

Referring to FIGS. 1A and 1B, a computer system 10 of the presentinvention is shown. As shown in FIG. 1A, the system 10 comprises a dataprocessing unit 12 with a program cartridge 14 removably connectedthereto. Also connected to the data processing unit 12 is a standardtelevision set (TV) 16, an optional keyboard 18, one or more optionalcontrollers 20a and 20b, and an optional CD drive 22. Although not shownin FIG. 1A, the standard TV 16 may be replaced with a pair of speakersand a display device that accepts a composite video signal.

The processing unit 12 comprises a central processing unit (CPU) 30, anaudio/video/CD drive (A/V/CD) controller/coprocessor 32, a system memory34, a first decode chip PAL1 35a, a second decode chip PAL2 35b (alsoshown in FIG. 4), an I/O processor 36, two cartridge connectors (oneindicated generally at 37a, the other not shown), additional circuitry38 required to generate the audio and video signals, and an expansionconnector (indicated generally at 39 in FIG. 4). These devices areconnected in circuit communication as shown in FIG. 1A. The additionalcircuitry 38 is shown in FIG. 1B and discussed in more detail in thetext accompanying FIG. 1B.

The CPU 30 generates multiple buses: a DATA bus 31a, an ADDRESS bus 31b,and a CONTROL bus 31c, as are well known in the art. These three busesare collectively referred to as the SYSTEM bus 31. In the preferredembodiment, the CPU 30 is an 80376, manufactured by Intel Corp., 3065Bowers Ave., Santa Clara, Calif., 95051. The 80376 is a variation of thewell known 80386SX, which is well known in the art and also availablefrom Intel Corp. The 80376 differs from the 80386SX in that the 80376starts up in 32-bit mode, rather than 16-bit mode. Specifically, the CROregister is forced to a 0011 H (0011 in hexadecimal notation) state withbit 0 forced to a logical ONE, effectively making the 376 operate in a32-bit memory mode. Paging is enabled to allow virtual 386 operation.

The A/V/CD controller/coprocessor 32 will be discussed in detail in thetext accompanying FIG. 4. Suffice it to say for now that the A/V/CDcontroller/coprocessor 32 comprises the following functional blocks: amemory refresher, a video controller, a blitter graphical coprocessor, aCD drive controller, a digital signal processor (DSP) sound coprocessor,and an arbitrator to arbitrate the access to the system memory betweenthe six possible bus masters (the CPU, the blitter, the DSP, the memoryrefresher, the video controller, and the CD drive controller). Thearbitrator controls the changing priorities of the devices, as describedherein, and is in electrical circuit communication with all the deviceswithin the A/V/CD controller/coprocessor 32. For example, the CPU 30 hasthe lowest priority of all bus masters until an interrupt occurs. Thus,the arbitrator is in circuit communication with both the CPU interface60 and the interrupt controller 68.

The CPU 30 has a SYSTEM bus 31 associated with it. The SYSTEM bus 31refers to the combined DATA bus 31a, ADDRESS bus 31b, and CONTROL bus31c, shown in FIG. 1. The A/V/CD controller/coprocessor 32 is thearbitrator for the system memory 34; therefore, the SYSTEM bus 31 ismodified to a SYSTEM' bus 61 (comprising the DATA' bus 61a, the ADDRESS'bus 61b, and the CONTROL' bus 61c) by the A/V/CD controller/coprocessor32.

The system memory 34 comprises screen RAM, system RAM, and bootstrapROM. The system memory 34 will be discussed in more detail in the textaccompanying FIG. 4.

The I/O processor 36 interfaces the CPU 30 to numerous I/O devices, suchas the keyboard 18, the controllers 20a and 20b, a digitizer (notshown), a mouse (not shown), a printer (not shown), and a touchpad (notshown). In the preferred embodiment, the I/O processor 36 is apreprogrammed MC68HC705C8 (hereinafter "68HC705"), manufactured byMotorola Corp, running at 2 MHz. The 68HC705 I/O processor 36 isinterfaced to the CPU 30 by configuring the 68HC705 as a peripheraldevice: (1) PA0-PA7 are connected to D0-D7 of the DATA bus 31a; (2) PB7,PB1, and PB2 are connected GPIO1 (a 32-byte address range decoded by theA/V/CD controller/coprocessor 32, as described below), A1, and A2,respectively, of the ADDRESS bus 31b and CONTROL bus 31c; and (3) PB3,PB4, and PB5 are connected to ADS, READY, and W/R, respectively, of theCONTROL bus 31c. Thus, the I/O processor is decoded to have four 16-bitaddresses in I/O space (referred to herein as AS0, AS2, AS4, and AS6).

The program inside the 68HC705 interfaces to the CPU 30 as follows. The68HC705 is designed to attach directly to the processor bus and act asan I/O port to the CPU 30. A pair of internal latches holds data passingbetween each of the processors until the other is ready to receive it.Status bits to each processor indicate the condition of the datalatches. Each can tell if the previous data has been read and if any newdata is waiting to be read by checking the status bits.

The I/O coprocessor 36 implements the following functions: (1) a 50 mstimer, (2) a serial controller link for the input devices, (3) acartridge sense, (4) a system reset, and (5) a data/strobe/acknowledge(DSA) CD control communications link for the CD drive 22.

The 50 ms timer is implemented using the watchdog timer of the 68HC705I/O coprocessor 36. When the watchdog timer expires, the I/O coprocessor36 interrupts the CPU 30 using analog interrupt 1 (AI1) of the A/V/CDcontroller/coprocessor 32. The CPU 30 responds to this by reading the16-bit I/O port AS0, describes above, which causes the A/V/CDcontroller/coprocessor 32 to activate the I/O coprocessor 36, therebycausing a data transfer between the CPU 30 and the I/O coprocessor 36.

The controllers 20, the keyboard 18, and all other input devices areconnected to the I/O processor 36 via the serial controller link. Thecontrollers transform the movements of the control devices into a formatsuitable for transmission along the serial link. The controllers senddata packets via the controller serial data link to the system unit. Thedata packets differ depending on the type of IO device. Co-ordinate typedevices (mouse, analog joystick, touchpad, etc) have a different datapacket then a switch closure type of device (keyboard, digital joystick,switch pad, etc).

The serial controller link consists of three (3) lines: a data receiveline, a VCC (+5 VDC) line, and a ground line. The 68HC705 implements thedata receive line of the controller serial link using the PDO/RDI pin.This pin is designed to be used as an interface to serial devices usingthe well known asynchronous format. A clocked synchronous format couldbe used in the alternative. The serial controller link is connected toexternal devices by a three conductor connector. Input devices are daisychained, thus a single device physically connects to the data processingunit 12.

The cartridge sense is implemented by having the I/O coprocessor 36 polla pin of the cartridge connector 37a. The pin is pulled to a logical ONEby a pullup resistor on the system planar and a properly connectedcartridge pulls the pin to a logical ZERO.

The reset is implemented by giving the I/O coprocessor 36 control overthe reset signals of the CPU 30 and the A/V/CD controller/coprocessor32. The CPU 30 can command the I/O coprocessor 36 to reset the system10. In addition, the I/O coprocessor 36 monitors the reset switch (notshown) for the system and resets the system when it detects a switchclosure.

The DSA CD control communication protocol is implemented using threepins of the 68HC705. The I/O coprocessor 36 uses this protocol tocommunicate commands to the CD drive 22 and to relay messages from theCD drive 22 to the CPU 30.

The first decode chip PAL1 35a is in electrical circuit communicationwith the CPU 30, the A/V/CD controller/coprocessor 32, and the twocartridge connectors 37a (the other not shown) along the ADDRESS bus 31band CONTROL bus 31c, as shown in FIG. 1A. The first decode chip PAL1 35aaccepts as inputs the upper two address lines, decodes the 16 megabyteaddress space of the 80376 CPU 30 into four 4 megabyte regions,represented by three chip select lines: two for the cartridge connectors37a (the other not shown) and one for the A/V/CD controller/coprocessor32. The upper four megabytes and the lower four megabytes are decoded tothe A/V/CD controller/coprocessor chip select and the two remainingfour-megabyte regions are decoded to two cartridge connector chipselects.

The data processing unit 12 also has a pair of cartridge connectors (oneindicated at 37a, the other not shown) for placing a cartridge 14 incircuit communication with the CPU 30 and other system components. Thecartridge 14 connects to the data processing unit 12 via a gold plated70-pin (two rows of 35 conductors) edge card connector 37b. Theprocessor unit 12 has two cartridge connectors 37a for accepting theedge card connections of the edge card connector 37b. The cartridges 14have gold plated card edge connections to match the conductors of theconnectors 37a, allowing the cartridges 14 to be pluggably connected tothe processor unit 12. The following signals are communicated toexternal devices via the cartridge connectors 37a (the other not shown):SYSTEM bus 31 signals, the DSA CD control signals, the I² S CD datasignals, a cartridge sense line, power, ground, analog interrupt 1 or 2(each cartridge has a unique interrupt), GPIO 2 or 3, a lock line (whichis a typical signal of the 80376 and 80386SX SYSTEM bus 31), and acartridge select, which is generated by the first decode chip PAL1 35a.

In addition, the processor unit 12 has a single 100-pin (two rows of 50pins each) edge card expansion connector (not shown in FIG. 1A,indicated generally at 39 in FIG. 4). The expansion connector 39 allowsdevices to add more memory to the system memory 34 and to add variousother features. Devices connected to the expansion connector 39 havegold plated card edges to match the expansion connector, allowing thedevices to be pluggably connected to the processor unit 12. Thefollowing signals are communicated to external devices via the expansionconnector 39: SYSTEM' bus signals (described in the text accompanyingFIG. 4), the DSA CD control signals, the I² S CD data signals, anexpansion connector 39 sense line, power, ground, CAS and RAS lines, andan expansion connector 39 select, which is generated by the seconddecode chip PAL2 35b.

The additional circuitry 38 of FIG. 1A is shown in FIG. 1B. Referringnow to FIG. 1B, the additional circuitry 38 comprises four devices: avideo digital-to-analog converter (video DAC) 40, an NTSC/PAL ("PAL"referring to the well known European television signal standard) encoder42, an RF modulator 44, and an audio analog-to-digitalconverter/digital-to-analog converter/compressor/decompressor(ADC/DAC/CODEC) 46.

The A/V/CD controller/coprocessor 32 has a number of functional blocksthat will be more fully described in the text accompanying FIG. 4.Suffice it for now that two such blocks are a video controller 66 and adigital signal processor (DSP) 74.

The video controller 66 of the A/V/CD controller/coprocessor 32 connectsto an external video DAC 40, which converts the eighteen bits of pixelinformation (six bits each of red, green, and blue) from the videocontroller 66 into an RGB signal, as is well known in the art. Eachcolor channel (R, G, and B) of the video DAC is implemented with an R2Rresistor tree and a 2N2222 transistor, as shown in FIG. 2. The devicesin FIG. 2 are in circuit communication, as shown. The resistors 41a-41jin FIG. 2 are all 0.25 watt resistors with the values shown, within 5%tolerance. The transistor 43 is a 2N2222.

Referring once again to FIG. 1B, the RGB signal is converted to NTSCcomposite video with the NTSC/PAL encoder 42. The NTSC/PAL encoder 42accepts the chroma clock, the HSYNC and VSYNC signals, which aregenerated by the video controller 66 of the A/V/CDcontroller/coprocessor 32, and the red, green, and blue video outputs,which are generated by the video DAC 40, and generates a composite videosignal in the well known NTSC or baseband video format. In thealternative, the well known PAL (European television signal standard)format can be generated. The composite video signal is connected toexternal devices with a single female RCA type phono jack, as is wellknown in the art. In the preferred embodiment, the NTSC/PAL encoder 42is an MC1377, manufactured by Motorola Corp.

The RF modulator 44 merges the composite video signal from the MC1377with the left and right audio line out signals from the audioADC/DAC/CODEC 46 onto a carrier frequency to generate an RF videosignal, indicated by RF Video, suitable for being directly inputted intothe TV 16. To generate the different PAL (European television signalstandard) and NTSC formats a different RF modulator and crystal must beused. The RF video signal is connected to external devices with a singlefemale Type F coaxial connector, as is well known in the art.

The audio ADC/DAC/CODEC 46 is linked to the DSP 74 with a serial linkconforming to the well known Philips I² S protocol. The ADC/DAC/CODEC 46converts analog data to digital data, and vice versa, and compresses anddecompresses digital data. The ADC/DAC/CODEC 46 interfaces externalstereo analog data from optional microphones to the A/V/CDcontroller/coprocessor 32. The audio inputs are connected to externaldevices with a standard stereo 1/4" connector. The audio ADC/DAC/CODEC46 also interfaces digital data from the A/V/CD controller/coprocessorto external devices by generating left and right audio line out signals.These signals are connected to external devices, such as optionalspeakers with two female RCA phone jacks, as are well known in the art.As mentioned above, the audio line signals are also added to the RFvideo signal.

In the preferred embodiment, the ADC/DAC/CODEC 46 is a CS4216,manufactured by Crystal Semiconductor. The part contains microphoneinputs, with programmable gain, as well as outputs with programmableattenuators. Gain and attenuation are both programmably controlled bythe DSP 74.

In the alternative, the ADC/DAC/CODEC 46 can be replaced with a TDA1311DAC manufactured by Philips. If this chip is used, the ADC and CODECfunctions will not be available.

Finally, the data processing unit 12 has a second decoder chip PAL2 35b,which is used to implement the chip select for the expansion connector39. The decode chip PAL2 35b is in circuit communication with the A/V/CDcontroller/coprocessor 32 and the expansion connector 39 along theSYSTEM' bus 61. The second decode chip PAL2 35b only permits the A/V/CDcontroller/coprocessor 32 to decode a 128K block of system ROM startingat F20000H. The range from F40000H to FFFFFFH is decoded by PAL2 35b foruse by the expansion connector 39. This block of ROM decoded by thedecode chip PAL2 35b is used to add ROM to the system 10 via theexpansion connector 39.

As shown in FIG. 1A, the program cartridge 14 comprises a program ROM 50and a locking circuit 52. The program ROM 50 contains code suitable forexecution on the CPU 30 in a read only memory format. In thealternative, other memory types, such as battery-backed RAM may be usedas the storage device in the cartridge 14. The program ROM 50 is incircuit communication with the CPU 30, as shown in FIG. 1A. In thepreferred embodiment, the locking circuit 52 comprises a memory controlcircuit, such as an address scrambler 54, and a lock control circuit 56.

The address scrambler 54 is interposed between the program ROM 50 andthe CPU 30 along the ADDRESS bus 31b, generating a scrambled ADDRESS"bus 55, as shown in FIGS. 1A and 3. As shown, the address scrambler 54need not have every address line as an input. The address scrambler 54can be implemented such that only address lines of an n-bit ADDRESS bus31b need be scrambled. In FIG. 3, address lines A₀ through A_(m) arescrambled to generate A₀ ' through A_(m) ', which are inputs to theprogram ROM 50. At least one of the lower two address lines should bescrambled to sufficiently scramble the data. As indicated in FIGS. 1Aand 3, the address scrambler 54 also generates a typical chip select 57for the ROM 50, as is well known in the art.

In the preferred embodiment, the three address lines A₀, A₁, and A₂ ofthe ADDRESS bus 31b are scrambled to form the ADDRESS" bus 55; theremaining lines of the ADDRESS bus 31b are the same as the ADDRESS" bus55. Line A₀ of the ADDRESS bus 31b is swapped to line A₂ of the ADDRESS"bus 55. Line A₂ of the ADDRESS bus 31b is swapped to line A₁ of theADDRESS" bus 55. Finally, line A₁ of the ADDRESS bus 31b is swapped toline A₀ of the ADDRESS" bus 55. This effectively scrambles the data inthe ROM 50 rendering it inexecutable. Moreover, each data byte in theROM 50 still has unique address, allowing the checksum (adding all bytestogether without regard for the carry) of the ROM 50 to be calculatedbefore attempting to unlock the cartridge.

The entire locking circuit 52 can be implemented on a programmable logicarray (PAL), a programmable logic device (PLD), an application specificintegrated circuit (ASIC), or a field programmable gate array (FPGA),among others well known in the art. The lock control circuit 56comprises a number of comparators in circuit communication with asynchronous state machine. The state machine is initialized into a"locked" state, causing the address scrambler 54 to scramble the addresslines. Incorrect addresses keep the state machine in that locked state.As each address in the correct sequence of addresses is asserted ontothe address bus, the appropriate comparator indicates the presence ofthat address, causing the state machine to transfer to the next state.If the correct addresses are presented in the correct order, the statemachine enters the "unlocked" state, causing the address scrambler 54 tocease scrambling the address lines. At any time before scrambler 54 is"unlocked," an incorrect address returns the lock control circuit 56 tothe initial "locked" state. Once the lock control circuit 56 unlocks thescrambler 54, the lock control circuit 56 keeps the scrambler 54unlocked until the machine is reset or the system power is cycled.

In the alternative, the lock control circuit 56 can be configured suchthat at the occurrence of one or more preselected events, the lockcontrol circuit 56 reenters the locked state, causing the addressscrambler 54 to rescramble the address lines until the correct sequenceof address is asserted onto the address bus in the correct order. Againin the alternative, the lock control circuit 56 need not be designed torequire the addresses to be asserted in the correct sequence. Rather,the state machine can be designed to merely require that all thepreselected addresses be asserted, without regard to the proper order.

When the system powers up, the lock control circuit 56 causes theaddress scrambler 54 to scramble one or more of the address lines fromthe CPU 30 to the program ROM 50. The lock control circuit 56 can also,in addition, be designed to cause the address scrambler 54 to scramblethe address lines in response to other events, such as the system beingreset, or the expiration of a one-shot multivibrator, which requires theCPU to assert the proper combination onto the ADDRESS bus 31bperiodically. The scrambling can take the form of swapping two or moreaddress lines (e.g., swapping address line A3 with address line A6) ormirroring one or more address lines onto one or more other address lines(e.g., causing the signal appearing on address line A3 to appear onaddress lines A3, A4, and A5 simultaneously). In the preferredembodiment, the address bus conductive paths are not physicallyscrambled (as would be the case if electromechanical relays were used toscramble the address lines); rather, the signals on the address busconductive paths are electronically swapped. Moreover, the addressscrambler 54 could, in the alternative, utilize multiple scramblingpatterns that are randomly selected.

Thus, the cartridge is "locked" and cannot not be used in unauthorizeddevices. Alternatively, the memory control circuit need not be limitedto an address scrambler 54. The locking effect might also be achievedusing a DATA bus 31a scrambler or a CONTROL bus 31c scrambler, or anycombination or permutation of DATA bus 31a, ADDRESS bus 31b, or CONTROLbus 31c scrambling. Thus, the address scrambler 54 need not scramble theADDRESS bus 31b lines, because a more generic "bus line scrambler" maybe used to implement the memory control circuit.

The address scrambler 54 may be implemented as a multiplexer thatswitches between the correct addresses and the scrambled addressesresponsive to an output from the lock control circuit 56.

The program cartridge 14 is thus "locked" to unauthorized devicesbecause the data being outputted by the program ROM 50 will notcorrespond to executable code in the proper sequence. Swapping ormirroring address lines will have the effect of substituting individualaddresses thereby shuffling the order of the code. Thus any unauthorizeddevice attempting to read the program ROM 50 within the cartridge 14while the address scrambler 54 is scrambling the addresses will readshuffled opcodes and operands in an order that will most likely bemeaningless. In any event, the application program will not execute asexpected while the address lines are shuffled.

To "unlock" the cartridge, the CPU 30 accesses one or more addressesalong the ADDRESS 31b bus in a particular sequence. The lock controlcircuit 56 monitors the ADDRESS bus 31b. Once the appropriate sequenceof addresses appears on the ADDRESS bus 31b, the lock control circuitcauses the address scrambler 54 to cease scrambling the address linesconnecting the program ROM 50 to the CPU 30. Once the address scrambler54 ceases scrambling the address lines, the CPU 30 can access the codein the program ROM 30 and execute the program therein.

Adding the address scrambler 54 and lock control circuit 56 tocartridges 14 will add very little (if any) cost to the programcartridge 14. Typically, cartridges make use of an address decoderwithin the cartridge 14 to decode the full width of the ADDRESS bus 31bto a memory range appropriate for the program ROM 50. For example, aone-megabyte ROM has twenty address lines; however, typically the entireADDRESS bus 31b of the CPU 30 is brought out to the cartridge 14. If theCPU 30 is an 80376 or an 80386SX, then the ADDRESS bus 31b is 24-bitswide; therefore, a memory decoder is required to decode the 24-bitaddress space down to a 20-bit region. Thus, it is typical for acartridge 14 to have an address decoder inside.

The address decoder is typically a programmable array logic (PAL) orprogrammable logic device (PLD). One suitable PAL is the 16V8, which iswell known in the art and is manufactured by numerous manufacturers,e.g., AMD Corp. The 16V8 PAL provides enough internal logic to implementthe address scrambler 54 and the lock control circuit 56, in addition tothe required address decoder. Thus, the locking circuit 52 of thepresent invention can be implemented into cartridges 14 with little orno additional cost per unit.

The address scrambler 54 provides a way of "locking" program cartridges14 against use in unauthorized systems. In addition, the system 10 ofthe present invention provides a means of preventing unauthorizedcartridges from being used in authorized systems 10 of the presentinvention.

Scrambling lines of the ADDRESS bus 31b has the effect of swappingand/or duplicating bytes in the memory space, as compared to theunscrambled memory space. Thus, an unauthorized cartridge is detected asfollows: (1) the CPU 30 reads a scrambled block of memory from theprogram ROM and saves the values to the system RAM within the systemmemory 34; (2) then the CPU 30 asserts the proper sequence of Naddresses onto the ADDRESS bus 31b causing the lock control circuit (ifany) within the cartridge to cause the address scrambler (if any) tostop scrambling the address lines; (3) the CPU 30 reads an unscrambledblock of memory from the same locations as in step (1) from the programROM; and (4) the CPU 30 compares the scrambled block of memory and theunscrambled block of memory.

"IN" in the above method should be selected to prevent false unlockingby a sequential read of addresses, which is typically performed as partof a checksum calculation or program execution. N=2 is a minimum and isonly acceptable if the values are not sequential. In the preferredembodiment, a sequence of approximately six (N=6) addresses will beused. The exact number of addresses used is a direct function of thenumber of latches and input pins available in the programmable part usedto implement the address decoder/scrambler 54. The more latches andinput pins available, the larger the state machine implementing the lockcontrol circuit 56 can be.

If the two blocks contain exactly the same data, then the cartridge inquestion does not have an address scrambler 54 and is, therefore, anunauthorized cartridge, and the CPU 30 can react accordingly (e.g.,halting, displaying a message and then halting, entering an endlessloop, etc.). On the other hand, if the data blocks read from exactly thesame locations in memory are different, then the cartridge does have anaddress scrambler 54 and the cartridge is deemed to be an authorizedprogram cartridge.

The blocks tested can be of virtually any size. Sixteen bits is asuitably sized block. In addition, the same block of memory need not betested each time the system 10 checks for an authorized cartridge.Moreover, the lock control circuit 56 can be designed to not cause thestate machine to enter the locked state when an incorrect address isasserted onto the ADDRESS bus 31b. Thus the addresses tested could bemixed with the addresses used to unlock the system.

Referring again to FIG. 1A, the interface between the compact disk drive22 and the data processing unit 12 is shown. Two buses control the CDdrive 22: (1) a DSA bus for controlling the CD drive 22 and (2) an I² SCD data bus. The DSA bus is generated by the I/O coprocessor 36 and theI² S CD data bus is generated by the A/V/CD controller/coprocessor 32.

Referring now to FIG. 4, the Audio/Video/CD Drive controller/coprocessor(A/V/CD controller/coprocessor) 32 electronics are largely containedwithin one massive custom logic chip, known as an ASIC (ApplicationSpecific Integrated Circuit). An A/V/CD controller/coprocessor 32meeting the description herein may be purchased from MSU Ltd., 270 Upper4th Street, Witan Gate West, Central Milton Keynes, MK9 1DP England. TheA/V/CD controller/coprocessor 32 contains a processor interface 60, aprocessor cache 62, a memory interface/refresh 64, a video controller66, an interrupt controller 68, a video blitter 70, a CD drivecontroller 72, a digital signal processor (DSP) 74, and a DSP memory 76.The processor interface 60, the memory interface/refresh 64, and thevideo controller 66 are referred to collectively as the video/memorycontroller 67. The system memory 34, central processing unit 30, andother devices lie outside the A/V/CD controller/coprocessor 32.

The SYSTEM' bus 61 electrically connects the various devices to thesystem memory 34. Sharing the SYSTEM' bus 61 are six possible busmasters (in order from highest priority to lowest priority,respectively): the memory refresh 64, the video controller 66, the CDdrive controller 72, the DSP 74, the blitter 70, and the CPU 30 (throughthe processor interface 60). Only one of the bus masters may control theSYSTEM' bus 61 (DATA' bus 61a, ADDRESS' bus 61b, and CONTROL' bus 61cbetween the A/V/CD controller/coprocessor 32 and the system memory 34)at any one time.

The video/memory controller 67 controls the SYSTEM' bus 61, and providesthe memory timing signals (e.g., CAS, RAS, write enable, etc.) formemory devices attached to the SYSTEM' bus 61, as is well known in theart. It also requires memory cycles (video memory cycles are required toread video data from system RAM; since video is generated in real timeby this process, the video logic must have memory access when video datais needed), and has effectively the highest priority on the SYSTEM' bus61, as mentioned above. It suspends bus master operations during videolines for brief periods to fetch any video display data, and to refreshdynamic RAM (DRAM). It also controls the interface with the CPU 30.

The DSP 74 is a simple, very high-speed processor for sound synthesis,operating at up to 33 million instructions per second (MIPs). It hasaccess to the SYSTEM' bus 61 via a DSP DMA controller (not shown), whichallows it to read and write bytes or words into system memory 34. Thesetransfers occur in short bursts, and are under DSP program control. TheDSP 74 actually executes programs and stores data in its own privatehigh-speed memory 76.

The compact disk read DMA channel of the CD controller 72 allows thesystem to transfer CD read data into system memory 34 without anysoftware overhead. It may transfer data directly, it also contains a CDblock decoder.

The interrupt controller 68 interfaces six internal interrupts to theCPU 30: video interrupt (highest priority), analog interrupt 1 (AI1),analog interrupt 2 (AI2), analog interrupt 3 (AI3), CD block decoderinterrupt, and DSP interrupt (lowest priority). The interrupt controllerautomatically clears an interrupt when the CPU 30 performs the interruptacknowledge cycle. A mask bit is available for each of the interrupts.

The blitter 70 is a graphics processor for fast screen updates andanimation, acting as a hardware graphics subroutine for the CPU 30 orDSP 74. It will become bus master through blitter program operation, andmay therefore own the SYSTEM' bus 61 for considerable periods. However,its priority over the CPU 30 is not absolute; it may be requested togive up the SYSTEM' bus 61 to the CPU 30 when an interrupt occurs. TheCPU 30 is the lowest priority bus master at the system level; however,it has complete control of the other hardware, therefore, the use of theSYSTEM' bus 61 is entirely under CPU 30 program control.

The A/V/CD controller/coprocessor 32 has four major blocks: avideo/memory controller 67, a compact disk read DMA 72, a blittergraphics coprocessor 70, and a DSP 74 audio coprocessor. The addressspace of the CPU 30 is decoded to a number of eight-bit registers withinthe A/V/CD controller/coprocessor 32. All internal locations are on evenaddress boundaries; word-wide I/O reads and writes may be performedwhere appropriate. In this particular embodiment, the byte-wide writesmay not be performed on word-wide registers and I/O cycles may not beused to access odd addresses.

In addition to the above registers, the A/V/CD controller/coprocessor 32generates three spare general purpose I/O decoder lines (GPIO1, GPIO2,and GPIO3) from the SYSTEM bus 31, each providing a 32-bit I/O addressrange. The general purpose decoders may be used to provide three activelow chip enables to devices external to the A/V/CDcontroller/coprocessor 32. In the data processing unit 12, the generalpurpose decoders are used to decode address ranges to the I/Ocoprocessor 36 (GPIO1) and the two cartridge connectors 37a (GPIO2 andGPIO3), which are explained more fully above.

The video/memory controller 67 performs four functions: video timing,interrupt handling, video display generation, and memory configuration,refresh, and timing.

The video/memory controller 67 has a flexible video timing generatorthat can be programmed to suit different TV standards and monitors up toa 640 by 480 VGA standard. The position of synchronization pulses,blanking, display area, active video (when the A/V/CDcontroller/coprocessor 32 is fetching data from memory) are programmedin clock cycles in the horizontal dimension and in line numbers in thevertical direction. Video timing is broken into two parts. Horizontaltiming is defined in terms of clock cycles and is determined by a numberof eleven-bit registers. Vertical timing is defined in terms of displaylines and is determined by a number of ten-bit registers.

There are nine horizontal registers: horizontal period, horizontal sync,horizontal blanking end, horizontal blanking begin, horizontal displaybegin, horizontal display end, horizontal fetch begin, horizontal fetchend, and horizontal vertical sync. The value written to the horizontalperiod register determines the horizontal line length in clock cycles.In one embodiment the line length is one greater than the number writtento the horizontal period register. The formula for the required numberis: horizontal period=(line length×clock frequency)-one.

The value written to the horizontal sync register determines the widthof the horizontal sync pulse. The width of horizontal sync in clockcycles is given by the difference between the horizontal period registerand the horizontal sync register. The formula for the required numberis: horizontal sync=horizontal period -(horizontal sync width×clockfrequency). The horizontal blanking end register determines when thehorizontal blanking ends and is the width of the back porch in clockcycles. The horizontal blanking begin register determines wherehorizontal blanking begins. The formula for the required number is:horizontal blanking begin=horizontal period-((horizontal syncwidth+front porch width)×clock frequency).

The horizontal display begin register specifies how soon video isgenerated after the trailing edge of horizontal sync in clock cycles. Ifthe horizontal display begin register is greater than the horizontalblanking end register the video/memory controller 67 outputs the bordercolor in-between. The value written to this register should normally bechosen to put the picture in the middle of the television screen. Theformula for a register number to do this is: horizontal displaybegin=(horizontal blanking end+horizontal blanking begin-(active displaywidth×clock frequency))/2.

The horizontal display end register specifies where the display ends andtherefore determines the width of the video display in pixels. It shouldbe programmed with the following number: horizontal displayend=horizontal display begin+(number of pixels×clocks per pixel). Ifhorizontal blanking begin is greater than horizontal display end, thenthe border color will be output until blanking begins.

The horizontal fetch begin register determines where video fetches firststart on the line. This should be programmed such that the sixteen bytepixel buffer has just been filled when the display begins. In practice,this means that the value in the horizontal fetch begin register isgiven by the value in horizontal display begin less a constant whichdepends on the display mode. The table below contains the constants forvarious combinations of bits per pixel and clocks per pixel. Forexample, if four bits per pixel and five clocks per pixel then theconstant is 160. Likewise, if four bits per pixel and one clock perpixel, then the constant is 32. Note that if there are 16 bits per pixeland one clock per pixel, then no constant is applicable.

    ______________________________________                                                   Clocks per pixel                                                              five  four    three   two   one                                    ______________________________________                                        Bits per pixel                                                                         four    160     128   96    64    32                                          eight   80      64    48    32    16                                          sixteen 40      32    24    16    n/a                                ______________________________________                                    

The horizontal fetch end register determines where video fetches end onthe line. In principle, this is the value in horizontal display endminus the above constant. However, horizontal fetch begin should berounded up so that horizontal fetch end register minus the horizontalfetch begin register is a multiple of the above constant.

The horizontal vertical sync is identified as wider sync pulsesoccurring on a number of lines. The width of these pulses is determinedby the horizontal vertical sync register which should be programmed asfollows: horizontal vertical sync=horizontal period-(vertical syncwidth×clock frequency).

The video/memory controller 67 also has a large number of verticalregisters: the vertical period register, the vertical sync register, thevertical blanking end register, the vertical blanking begin register,the vertical display begin register, the vertical display end register,the video interrupt register and the light pen registers. The verticalperiod register specifies the number of video lines per field. Thevertical sync register determines the number of lines on which verticalsync is generated. It should be programmed as follows: verticalsync=vertical period-lines of vertical sync.

The vertical blanking end register determines how many lines are blankedafter a vertical sync. The vertical blanking begin register determineshow many lines are blanked before vertical sync. It should be programmedas follows: vertical blanking begin=vertical sync-lines of blankingprior to vertical sync.

The vertical display begin register determines the first line of activevideo. If this register is greater than the vertical blanking endregister the lines inbetween show the border color. To position theactive area in the middle of the screen this register should beprogrammed as follows: vertical display begin=(vertical blankingend+vertical blanking begin number-of active lines)/2. The verticaldisplay end register determines the last line of active video. If thisregister is less than the vertical blanking begin register the linesin-between will show the border color. To position the active area inthe middle of the screen this register should be programmed as follows:vertical display end=(vertical blanking end+vertical blankingbegin+number of active lines)/2.

The video interrupt register determines the video line on which a videointerrupt is generated. This interrupt may be enabled or disabledthrough the INT register. The interrupt occurs when the video mechanismstops at the end of the display line. It may be used by the processor tochange display modes or to perform beam synchronous animation. Theregister may be reprogrammed within a field to provide severalinterrupts per field.

The A/V/CD controller/coprocessor 32 has a Light-Pen (or light-gun)input. The first rising edge on this input every field transfers thehorizontal count and vertical count into registers LP0 and LP1 onerespectively. These values can be converted to the X and Y coordinatesof the pixel pointed at. Bit one of register STAT is set if a risingedge on the light-pen input occurred this field. This register bitshould be read just prior to vertical sync.

The following table provides typical values for the above registers forthe various display formats shown. After loading the registers with thebelow values, the video timing generator is enabled by setting the VIDENbit in the register MODE2.

    ______________________________________                                                 50 Hz PAL 60 Hz NTSC                                                                              VGA                                                       320 × 256,                                                                        320 × 220,                                                                        640 × 480,                                          8-bits    8-bits    8-bits                                           ______________________________________                                        Clock      22.17 MHz   21.48 MHz 25.17 MHz                                    frequency                                                                     Horizontal 1418        1363      790                                          period                                                                        Horizontal 1314        1262      703                                          sync                                                                          Horizontal 126         103       48                                           blanking end                                                                  Horizontal 1271        1232      688                                          blanking begin                                                                Horizontal 378         348       48                                           display begin                                                                 Horizontal 1018        988       688                                          display end                                                                   Horizontal 346         316       32                                           fetch begin                                                                   Horizontal 986         956       672                                          fetch end                                                                     Horizontal 103         89        0                                            vertical sync                                                                 Vertical   312         262       525                                          period                                                                        Vertical sync                                                                            309         259       524                                          Vertical   20          15        34                                           blanking end                                                                  Vertical   307         257       514                                          blanking begin                                                                Vertical   35          26        34                                           display begin                                                                 Vertical   291         246       514                                          display end                                                                   ______________________________________                                    

The video/memory controller 67 has three color resolutions available:four bits per pixel, eight bits per pixel, and 16 bits per pixel. Infour- and eight-bit modes, the pixel is a logical color that indexes an18-bit physical color stored in the palette. In 16-bit mode, the pixelis a physical color in which bits zero to four are blue, bits five toten are green and bits 11 to 15 are red. Because there are six bits ofgreen but only five bits of blue and red, the least significant bits ofblue and red output from the chip are always logical ZERO in 16-bitmode. The border color is a 16-bit register which is displayed as a16-bit pixel.

In eight-bit mode, the pixel addresses the whole 256 by 18 palette. Infour-bit mode the pixel addresses 16 entries from the palette in whichcase the top four bits of the addresses are supplied from the indexregister.

Two variations are available in eight-bit mode. In color hold mode ifthe pixel takes the value zero, then the color of the previous pixel isdisplayed. This can be used to fill large areas of color simply bysetting the left most pixel.

In variable resolution mode, the most significant pixel determineswhether the pixel is displayed as one seven-bit pixel or two three-bitpixels. If the bit is clear, the pixel is displayed as one seven-bitpixel; if the bit is set then bits zero to two are displayed firstfollowed by bits four to six. In this case, the two high resolutionpixels address eight entries from the palette. The top five bits of theaddress are supplied from the index register. Variable resolution modeis useful for displaying small regions of high resolution text amid alower resolution, but more colorful, background. This mode is notavailable in one clock per pixel resolution.

In eight-bit mode any of the bits can be sacrificed and used for otherpurposes. For instance, a bit could be used to identify "hot spots" forcollision detection. Alternatively, bits could be used to encode image"depth" so that one image can move in front of or behind another. Tosacrifice a bit, the same bit in a masked register is set and that bitwill be replaced from the corresponding bit in the index register.

There are five widths of pixel: one clock, two clocks, three clocks,four clocks, and five clocks. These correspond to dot clocks of around24 MHz, 12 MHz, and 6 MHz. The highest dot clock may not be used withthe 16 bits per pixel display mode. Two other combinations: one clock8-bit and two clock 16-bit may only be used if 32-bit DRAM is fitted. Ifexternal hardware is fitted, the A/V/CD controller/coprocessor 32 cangen-lock to an external video source and mix (encrust) local video withexternal video on a pixel by pixel basis.

The memory map of the screen is not tied to the video display width butis defined independently. The base address of the screen can be anywherein system memory 34. The width of the screen memory is the power of 2from 128 to 2048 bytes. The height of the screen is a power of 2 from32K to 2 megabytes. Video addresses on the same line wrap within thesmaller boundary. This arrangement allows the screen to be placed withina larger virtual screen and panned and scrolled within it.

Various registers control the video modes discussed above. The videomode register controls the features listed above. Bits zero and onedetermine the number of bits per pixel. Bits two and three determine thepixel width in clock cycles. Bits four through six determine the firstbreak in the video address and hence the display width in bytes. Bitsseven through nine determine the second break in the video address andhence the display height in bytes. Bit ten turns the sync outputs intoinputs which can reset the horizontal and vertical timers for rapidlocking to an external video source. Bit 11 controls encrustation, whichis the overlaying of an external video source using an external videomultiplexer. The multiplexer is controlled by the "INC" pin of theA/V/CD controller/coprocessor. Selected bits of the color are used tocontrol encrustation. Bit 12 controls border encrustation, which is thesame as bit 11 but only applied to border colors. Bit 13 sets a variableresolution mode. Bit 14 sets the color hold mode, in which color 0 isreplaced by previous non-zero color in current scan line. Bit 15 enablesPixel clock widths of three and five based on Bits 2, 3, and 15, asshown in the table below.

    ______________________________________                                        Bit 2    Bit 3  Bit 15      Pixel Clock                                       ______________________________________                                        0        0      0           Four clock cycles/Pixel                           1        0      1           Two Clock Cycles/Pixel                            0        1      0           One Clock Cycles/Pixel                            1        1      0           Undefined                                         0        0      1           Three Clock Cycles/Pixel                          1        0      1           Five Clock Cycles/Pixel                           0        1      1           Undefined                                         1        1      1           Undefined                                         ______________________________________                                    

The video/memory controller 67 also has a pixel mask register and apalette index register. For every bit set in the mast register, thecorresponding bit in the pixel is replaced by the bit from the indexregister. The upper bits in the index register form the high part of thepalette address for 4-bit pixels. The border color register is a 16-bitregister that defines the border color. The color is displayed in thesame way as 16-bit pixels: bits zero to four are blue, bits five to tenare green, and bits 11 to 15 are red.

The video/memory controller 67 also has two screen address registersthat define the 24-bit base address of the screen in system memory 34.This is the address of the top left pixel on the screen.

The video/memory controller 67 also has an auxiliary video mode registerMODE2 that provides additional control over video and various testlogic. Bit zero enables the light-pen registers so that the horizontaland vertical counters can be read. Bit two enables the video timer, bitsthree and four determine the refresh frequency with one indicating arefresh frequency of clock/128, two indicating a refresh frequency ofclock/256, and three indicating a refresh frequency of clock/512. MostDRAMs require a refresh frequency of 64 KHz or above. The refreshcontroller waits until eight or more refresh cycles are required thenrequests the SYSTEM' bus 61 and does the required number of CAS beforeRAS cycles. When bit six is set, the video mode is double buffered andcan only change during blanking. The CPU 30 sets this bit for clean modechanges in split screen operation. Bit seven inverts the polarity ofvertical sync. Bit eight inverts the polarity of horizontal sync and bitnine is not used.

The palate is a 256 by 18 bit block of RAM at F10000H-F103FFH. Eachentry contains six bits each of green, red, green and blue. Each entryextends across two words. The blue and green bits appear in the highword. The red bits appear in the low word. Bits two through seven of thehigh word are blue; bits 10 through 15 of the high are green and bitstwo through seven of the low word are red. To write to an entry in thepalette, the CPU 30 must first write the red bits to the low word, thenthe green and blue bits to the high word. The CPU 30 should only writeto the palette during border or blanking or speckles will appear on thevideo.

The cache 62 is not a cache in the sense that it prefetches instructionsfor the CPU 30. Rather, the cache 62 is a 512×16-bit static RAM locatedat F14000H to F143FFHH that can be used by the CPU 30 for variables,stack, or program code to speed up program execution. It comprisesstatic RAM and is not subject to page faults. Placing data, stack, orprogram code in the cache 62 allows quicker accesses and fewer pagefaults. In this embodiment, the cache is small and byte writes are notallowed to the cache area. Interrupt service routines may not push bytesonto the stack.

Video/memory controller 67 supports six interrupt sources: video inputinterrupt, three analog interrupts, CD block decoder interrupt, and aDSP 74 interrupt. The analog interrupts allow simple analog-to-digitalconverters to be implemented. A monostable vibrator is implemented froma diode, a capacitor, and a potentiometer. The capacitor is dischargedby vertical sync and begins charging at a rate dependent on thepotentiometer setting. When the voltage on the capacitor reaches thethreshold of the input to the A/V/CD controller/coprocessor 32, aninterrupt is generated. The processor can then read the vertical counterto get a measure of how quickly the capacitor charged, an hence thepotentiometer setting.

The video/memory controller 67 also has an interrupt enable registerallowing all six interrupts to be independently enabled or disabled.Writing a logical ONE to any bit in the interrupt acknowledge writeregister clears the corresponding interrupt. The interrupt read registerreflects all pending interrupts.

The video/memory controller 67 decodes the 16 megabyte address range ofthe 80376 CPU 30 into the following memory map: eight megabytes of DRAMO(OH-7FFFFFH), seven megabytes of DRAM1 (800000H-EFFFFFH), 64 kilobytesof ROMO (F00000H-F0FFFFH), 64K of internal memory (F10000H-F1FFFFH), anda 896K block of ROM1 (F20000H-FFFFFFH). The 64 kilobytes of internalmemory comprises palette RAM, blitter registers, and DSP registers andmemory. The palette address range was stated above. The blitterregisters extend from the range F10400H to F107FFH. The DSP memoryextends from F10800H to F18000H.

The on-board screen RAM and system RAM is 512K of DRAM. The on-boardDRAM comprising the screen/system RAM may be either 16-bits or 32-bitswide. Suitable DRAM are the TCS1417BJ 256 kilobyte by 16-bit memorychip, manufactured by Toshiba. The size of the DRAM is determined by theA/V/CD controller/coprocessor 32 during reset but does not directlyaffect the CPU 30. Instead, it allows the video/memory controller 67 tooperate more quickly leaving more bandwidth available to other busmaster candidates. Certain display and blitter modes are only possiblewith 32-bit memory. Two banks of DRAM may be attached, as indicatedabove. If small amounts of DRAM are attached, then they will be repeatedthroughout the memory map shown above.

The bootstrap ROM is always 16 bits wide. The bootstrap ROM comprisestwo 27C512 erasable programmable read-only memories, manufactured bynumerous manufacturers, thereby giving 128K of bootstrap ROM. Followinga reset, the one megabyte window from F20000H to FFFFFFH containing ROMand internal memory is repeated throughout the 16 megabyte addressrange. This allows for a variety of processors to boot with the A/V/CDcontroller/coprocessor 32. The memory map above is adopted the firsttime with the memory type register is written to by the CPU 30. Thevideo/memory controller 67 performs page mode cycles on the systemmemory 34 wherever possible. These are quicker than normal memory cyclesand occur if successive reads and writes are within the same page. Thevideo/memory controller 67 needs to know the number of columns in theDRAM, which is programmed in the memory type register. In the memorytype register, bit 0 and 1 determine the number of columns in the DRAM,with 0 indicating 256 columns, 1 indicating 512, 2 indicating 1024, and3 indicating 2048.

The video/memory controller 67 supports seven types of transfers: anormal DRAM cycle (4 clocks), a page mode DRAM cycle (two clocks), ROMcycles (6 clocks), internal memory (2 clocks), external I/O (6 clocks),interrupt acknowledge (2 clocks), and internal I/O (2 clocks). The CPU30 will cycle in one more clock cycle than the actual transfer. Internalbus masters can cycle in the transfer time.

The video/memory controller 67 uses a crystal oscillator for a crystalthat is the 2× (2 times speed) clock for the CPU 30 and is a multiple ofthe television chrominance (chroma) subcarrier. This crystal clock isbuffered and output to the CPU 30. The same clock is put through adivide by two and this is output as the main system clock. This clock isinput to the A/V/CD controller/coprocessor 32 through a separate pin.The reason for outputting and inputting the clock is so that therelative skew between the CPU 2× clock and the main system clock, can beadjusted one way or the other by adding small delays to either path. Thecrystal frequency also is divided by a programmable divider which candivide the crystal frequency by a number between 1 and 15 and produce anoutput waveform with an even mark to space ratio. This is used as thetelevision color subcarrier.

The chroma divider register is a 4-bit register that defines the ratioof the television color subcarrier (chroma) to the 2× crystal frequency.It should be programmed as follows: chroma=2× crystal frequency/chromafrequency-1.

The video/memory controller 67 also has a status register. If the statusregister bit 0 is set, the video timing should be set up for PAL(European television signal standard). If bit 0 of the status registeris clear, then the video timing should be set up for NTSC. If bit 1 ofthe status register has been set, then there has been a light-pen inputin the current field. This bit is set by the light-pen and cleared bythe vertical sync.

The video/memory controller 67 can be put into a mode during reset afterwhich it only responds to two-word wide I/O locations and 64K memorylocations. The actual location of the I/O locations is determined by achip select input so the locations can be determined externally. This"peephole" mode allows the A/V/CD controller/coprocessor 32 to occupyonly small gaps in the I/O and address memory map of the system 10.

The registers are 32-bits wide and must, therefore, be accessed as two16-bit accesses. To address all the I/O registers within the A/V/CDcontroller/coprocessor 32, the regular I/O address of the requiredregister is first written to the lower word (a 1! low) then thatregister can be read or written at the upper word (a 1! high). Toaddress all the memory inside and outside the A/V/CDcontroller/coprocessor 32 the 64K window can be moved to any 64Kboundary in the 16M address space normally decoded by the video/memorycontroller 67 by writing to the bank register. The bank register is aneight-bit register providing the eight most significant bits whenaddressing memory in peephole mode. For example, to access the palette,formerly at F10000H, the CPU 30 must write 0F1H to the bank register andthen read and write at the bottom of the peephole location, determinedby the external chip select.

The blitter 70 is a graphical coprocessor whose purpose is to performgraphics creation and animation as fast as possible (limited by thememory bandwidth). It executes commands written by the CPU 30 and theDSP 74 into memory. It can perform arbitrarily long sequences ofgraphics operations by reading new command sets from system memory 34.While it is performing graphics operations, the blitter 70 becomes aSYSTEM' bus 61 master, and denies the CPU 30 any bus activitywhatsoever. This is reasonable because the blitter 70 is being used toperform operations that the CPU 30 would otherwise have performed, andis therefore speeding up program operation. This also removes the needfor any synchronous control programming for blitting operations and theneed for any interrupt generation hardware in the blitter 70. However,to allow real time programming of either of the other two processors(the DSP 74 and the compact disc DMA), the blitter 70 will suspend itsoperation and grant the SYSTEM' bus 61 to the DSP 74 or the compact discDMA channels if they require a DMA transfer. It will also suspend itselfand give up the SYSTEM' bus 61 to the CPU 30 if an interrupt occurs.During any of these transfers, the current operation is suspended butwill restart when the interrupt signal becomes inactive or when the DSP74 DMA access completes.

The operation of the blitter 70 is best viewed as a simple program:

    ______________________________________                                        read command from memory                                                      for n=0 to outer.sub.-- count                                                 read parameters from memory                                                   for m=0 to inner.sub.-- count                                                        if SRCEN then read source from memory                                         if DSTEN then read destination from                                    memory                                                                               write destination to memory                                            next m                                                                        next n                                                                        ______________________________________                                    

The commands and operands are written to memory by either the CPU 30 orthe DSP 74.

The blitter 70 has several registers in the A/V/CDcontroller/coprocessor 32 I/O space: (1) two writable blitter programaddress registers, which share the same I/O address as two readableblitter destination registers, (2) a writable blitter command register,which shares the same I/O address as a first readable blitter sourceaddress register, (3) a writable blitter control register, which sharesthe same I/O address as a second readable blitter source addressregister, (4) a readable inner count register, (5) a first writableblitter diagnostics register, which shares the same I/O address as areadable blitter outer count register, (6) a second writable blitterdiagnostics register, which shares the same I/O address as a readableblitter status register, and (7) a third writable blitter diagnosticsregister.

The blitter 70 may be operated in a variety of modes to perform graphicsand block move operations. The blitter 70 has an internal architecturedivided into three largely separate blocks: the data path, the addressgenerator, and the sequencer. The data path contains three dataregisters: the source data register, the destination data register, andthe pattern data register. The data path also contains a versatilecomparator to allow intelligent blitting operations, and a logicfunction unit (LFU) to generate the output data.

The address generator contains three address registers: these are theprogram address register used to fetch blitter commands, and the sourceregister and the destination address registers. It also contains anarithmetic logic unit (ALU) with an associated step register to updateaddresses, and a multiplexer to generate the output address.

The sequencer acts in software terms as the program that the blitter 70runs, with two loops (an inner loop and an outer loop) and a severalprocedures, as illustrated above with the short simple program. Theprogram is fixed, although various parts of its operation areconditional upon flags in the blitter command register and the loopcounts are also part of the command.

The data path contains three data registers and two data manipulationblocks: the logic function unit, which can combine the contents of thedata registers in a number of useful ways to produce the output data,and the comparator, which can perform certain comparisons on the data toinhibit write operations, and optionally stop blitter operation.

The data path can handle data of four sizes: 32-bit, 16-bit, 8-bit, and4-bit. Long words (32-bits wide) are used when performing fast blockmoves and fills. Pixels (4-, 8-, or 16-bits wide) may be manipulatedusing all the blitter modes, such as line-drawing, multiple planeoperations, character painting, etc.

The majority of the data path is 16-bits wide, which is the maximumscreen pixel size. However, the source data register is 32-bits wide,and the top 16-bits of the source data register are used to produce thetop 16-bits of the data written in 32-bit mode, regardless of the modeof the logical function unit.

Thus, there are two 16-bit wide registers (pattern data and destinationdata) and one 32-bit wide data register (source data register). Thesource and destination data registers are loaded from the source anddestination addresses in system memory 34 when the corresponding readcycles are enabled in the inner loop. However, all three data registersare loaded at the start of blitter operation with the pattern data, andthis may be used as an additional source of data, either in producingthe output data or in the comparator. For example, the data in thepattern data register could be a mask, a pattern for writing, or areference value, for example. The pattern data is loaded into both wordsof the source data register.

The logic function unit generates the output data, which is written tothe destination in system memory 34. It can perform any logicalcombination of the source and destination register pixels. "Source datapixels" may be selected from either of the source data register or thedata pattern data register. The LFU selects any of the four Booleanminterms (A & B, A & B, A & B, and A & B) of the two sets of input datafrom the data registers, and generates the logical OR of the twoselected minterms. This allows any logical combination of input data;thus 16 functional possibilities exist.

In 32-bit mode, the LFU will normally be set to produce source data,because it is only 16-bits wide. The upper sixteen bits written during along-word write are always derived from the top sixteen bits of thesource register.

The comparator can perform a variety of comparisons on the data in thesource, destination, and pattern data registers. If its comparisonconditions are met, then it generates an inhibit signal. The inhibitsignal is used to inhibit a write operation, and optionally, to stop theblitting operation. The comparator may also be used to provide a pixelplane effect, to give transparent colors, for collision detection andsystem memory 34 search operations, and as an aid to character painting.

A multiple plane operation is supported by assigning a plane number toevery pixel. This mode is only applicable to 4 and 8-bit pixels. In8-bit pixel mode, two of the 8 bits (bits 6 &7) are used giving two orfour planes; in 4-bit (nibble) pixel mode, one of the 4 bits (bit 3 &bit 7 of the two-nibble byte) is used giving two planes. The comparatorcan produce an inhibit output if the plane number of the destinationdata is not equal to or greater than the plane number of the sourcedata, or any combination of these. This means the data being writtenonto the screen can be masked by data already present in a differentplane.

The comparator can produce and inhibit output if the entire source pixelis equal to or not equal to the destination pixel. This may be used, forexample, for searching system memory 34 for a particular value and, moreimportantly, for designating a color to be transparent and holding thetransparent color value in a data register. This applies to 16-, 8-, or4-bit pixels.

The blitter 70 also has a comparator bit to pixel expansion modeoperation. This comparator operation allows bit to pixel expansion ofdata, used, for example, for character painting. In this mode, thecomparator selects a bit of the source byte based on the value of theinner counter and inhibits the write operation if this bit is a logicalZERO.

The blitter 70 makes provision for handling three pixel resolutionmodes. These are: 16-bit mode where each word corresponds to one pixel,8-bit mode, where each byte corresponds to one pixel, and 4-bit mode,where each byte corresponds to two pixels. In 8- and 16-bit pixel modes,the data path is handling one pixel at a time, and operation is straightforward. In 4-bit pixel mode, however, only half of the byte that isread from or written to system memory is the current pixel, therefore,certain additional requirements are placed on the data path. In a 4-bitmode write operation, unchanged destination data is written to the halfof the data byte that does not correspond to the current pixel. Thus,destination reads must always be enabled in 4-bit mode (set control bitDSTEN). This must be done because there is no provision for writing lessthan one byte into main memory.

It is also possible that the source 4-bit pixel address and thedestination 4-bit pixel address point in different halves of thecorresponding bytes of RAM. If this is the case, a shifter swaps the twohalves of the source data. In 4-bit mode, the two nibbles (half a byte;4 bits) of the pattern byte should normally be set to the same value.Note that the pixel with program in the blitter 70 does not have tomatch the display width, and the most efficient way of moving largeamounts of data is 32-bit mode. Recall that such mode transfers must belong-word aligned and the system must be fitted with 32-bit RAM.

The blitter 70 also has an address generator. The address generatorcontains three address registers, an increment or step register, anaddress adder, and an address output multiplexer. The three addressregisters hold the source address, the destination address, and theprogram address. Each of these registers is a 24-bit register allowingthe blitter 70 to address up to 16 megabytes. In addition, the sourceand destination address registers contain a nibble bit used in 4-bitpixel mode. The program address register holds the address that theprogram is fetched from, and is incremented by one word each time amemory cycle is performed using it. This register is always even, thus,bit 0 must always be a logical ZERO.

The source and destination address registers are updated after eachcycle, and at other times, using an adder that allows them considerableflexibility in the objects to which they refer. All source anddestination address updates, may be performed optionally on just thebottom 16 to 19 bits of the address register. This means that theblitter 70 will then effectively operate in 64K, 128K, 256K, or 512Kpages. In this mode, if an address overflows within a page, it will wrapand the overflow or underflow will be lost.

The blitter 70 also has an address adder, which is a 25-bit wide adderused to update addresses. It allows either a constant value of 0.5, 1,or 2 or a variable stored in one of the step registers, to be added toan address value. It can also subtract the same values. The 25th bit isthe nibble part of the addresses, as stated above. An increment of onepixel has a different effect on the address depending on the currentsetting of the screen resolution.

All address registers are updated automatically at the end of theappropriate memory cycles; source read for the source of addressregister, and destination write for destination address register.Addresses can be made to wrap vertically by using the SWRAP and DWRAPbits in the blitter command, and horizontally by using the SLWRAP andDLWRAP bits in the blitter control register.

The address output multiplexer provides the external address to thesystem memory 34. It provides three types of addresses: source address,destination address, and the program address. These are derived directlyfrom the corresponding address registers.

When the blitter 70 is drawing lines, the address registers are used ina different way than normal. The destination address register is used asthe line draw address, and the source address register and the stepregister are used as delta one and delta two respectively. During linedrawing delta two is subtracted from delta one, and the borrow outputproduced is used to determine what is added to the destination addressregister. For further details, see the section on line drawing below.

The blitter 70 also has a sequencer which controls the operation of theblitter 70. The flow of control is best considered at two levels. Thereis an outer loop governing the overall flow of control and an inner loopwhich performs the actual blitting or line drawing operation. The threesections within the outer loop: the command read procedure, theparameter read procedure, and the inner loop.

The inner loop performs the actual blitting or line drawing operations.An inner loop cycle can contain up to three memory cycles. These are aread from the source address, a read from the destination address, and awrite to the destination address. All three cycles are optional. If theloop includes a source read, or a source read and a destination read,then the comparator inhibit mechanism is tested before the destinationwrite occurs. This allows the write cycles to be bypassed when acomparator inhibit condition is met. When the comparator inhibitconditions are met, it is possible to have the current operations ceaseand control returned to the CPU 30. The program may then examine theaddress registers to determine where the inhibit has occurred, so thatcollision detection may be performed. The CPU 30 may then determinewhether to resume the operation or abort it. The inner loop performsoperations until the inner loop counter reaches zero. The inner loopcounter is a 10-bit counter, so the inner loop can iterate any number oftimes from 1 to 1024.

The blitter 70 makes provision for collision detection by allowingoperation to stop when a comparator write inhibit occurs. When thishappens, control returns to the CPU 30, which may then examine theinternal state of the blitter 70 to determine what has caused thecollision. At this point, the CPU 30 may choose to allow the blitter 70to resume the operation it was performing, or may reset it back to itsidle state. Either a reset or a resume command must be issued before theblitter 70 may be used for another operation. Note that while theblitter 70 is in the suspended state, a new value may be written to thecommand register, so that the collision stop mechanism may be disabled.

The parameter read procedure is a very straightforward sequence thatloads a new set of parameters to the inner loop. It reads from memory,in order, the inner loop counter value, the step register values, andthe pattern value, which is used to preset the data registers. The innercount effectively becomes the number of times the inner loop isexecuted. The step registers are used for address incrementing and thepattern register is used for data manipulation.

The parameter read procedure is called as part of a command readprocedure at the start of a blitting operation and is also called ifrequired by a blitting operation, as determined by the PARRD controlbit. Extra parameter reads occur between passes through the inner loopto allow parameters to be altered, thereby allowing operations such asirregular shape painting and run-length encoded data decompression.

The command read procedure is used to start a new blitting operation.The blitter 70 starts in an inactive reset state, which represents thenormal inactive state of the blitter 70. From this state a commandregister write is performed to start the blitter 70, usually preceded bya write to the program address register. A full set of operationalparameters is loaded from program count address which isauto-incremented, and control passes out of the command read loop. Whena blitting operation is complete, a new command is read from the programcount address and if this command leaves the blitter 70 in run mode,then a new set of parameters is loaded and another operation is started.Otherwise the blitter 70 enters its stopped state and returns theSYSTEM' bus 61 to the CPU 30. The above mechanism allows the blitter 70to perform arbitrarily long sequences of graphics commands withoutrequiring any processor intervention. This is extremely useful becauseprocessor I/O write cycles are relatively slow in comparison to blittermemory reads.

Normal operation of the outer loop starts on exit from the command readloop. The parameter read loop is then entered to read the first set ofparameters and the inner loop is entered with the inner counter beingloaded to its initial value before the start of operation. The outercounter is then decremented, and, if it is zero, the command read loopis entered. Then either or both of the source address and destinationaddress registered may be updated with the contents of the stepregister. The parameter read loop may then be optionally entered toupdate various inner loop parameters, before the inner loop is enteredagain. The two loops allow the blitter 70 to perform operations on withtwo-dimensional screen structures, with the outer loop address registerupdates moving screen address pointers onto the start of the structureon the next line. The parameter read loop adds flexibility whileallowing the screen structure parameters to be altered on a line-by-linebasis.

The blitter 70 also has a memory interface state machine, which controlsthe cycle timing generation and the bus arbitration of all memorycycles. The blitter 70 assumes control over the SYSTEM' bus 61 from theCPU 30 for the duration of a blitter command sequence. This is subjectto the bus handover latency discussed above, but as soon as the blitter70 is granted the SYSTEM' bus 61 its operation will start. In thepreferred embodiment, the blitter 70 allows the CPU 30 to access thecartridge ROM 50 and the cache 62 while any device within the A/V/CDcontroller/coprocessor has control over the SYSTEM' bus 61. However, forsimplicity, in the alternative, the blitter 70 can halt the CPU 30 whilethe CPU 30 is not the SYSTEM' bus 61 master.

The memory interface will give up the SYSTEM' bus 61 to the DSP 74 orthe compact disc read channel as soon as one of these requests theSYSTEM' bus 61, pausing only to complete any current memory cycle.

Interrupts will also cause the blitter 70 to suspend operation, unlessmasked in the blitter control register. The blitter 70 detects the stateof the interrupt line itself and uses this to suspend operation.Operation will resume as soon as the interrupt line resumes to its priorstate, which occurs when the CPU 30 write to the acknowledge portoccurs. This may not be necessarily the end of the interrupt serviceroutine, therefore programmers should be wary of stack crawl, and shouldnormally keep interrupts disabled during a service routine. The blitter70 resumes operation as soon as the interrupt line is cleared withoutintervention from the CPU 30. The blitter 70 only responds to theinternal interrupt sources (the video interrupt the analog inputinterrupts and compact disk interrupts). Any external CPU interruptsource has no effect on the blitter 70.

The blitter 70 has numerous modes of operation. The simplest operationsperformed by the blitter 70 are those involving copying one block ofsystem memory 34 to another and filling a block of system memory 34 witha predefined value. These operations can be performed on linear parts ofsystem memory 34 and on arbitrary screen rectangles. The destinationdata register is used as the address of the system memory 34 beingmodified and the source address register is used as the address of thedata being copied, if it is a copy operation.

When the operation is to be performed on linear areas of memory, most ofthe address control bits will be set to zero. The step register is notused, and the only requirement is to determine whether the copy will bemade with the address incrementing or decrementing, in setting DSIGN andSSIGN appropriately. Note that the initial value placed in the addressregister should be the bottom of the area upon which the operation is tobe performed if the sign bit is not set and at the top if it is set. Inboth cases, the first pixel read or written will be the first address.The length of the operation will be placed in the inner counter and theouter counter set to one.

If the block being operated upon is very large, both the inner loopcounter and the outer loop, may have to be used and the number of pixelsoperating on will be given by the product of the inter and outer countervalues. When either or both of the source and destination data arerectangles rather than linear areas, then the inner loop counter willcontain the rectangle width and the outer loop counter the rectangleheight.

The appropriate step register is set to the address increment from theright-hand side of the rectangle around to the left-hand side on thenext line. The SRCUP and DSTUP bits are set according to whether thesource or destination are rectangles. In 8- or more bits per pixel mode,neither SRCEN nor DSTEN will be used for memory fill, bit SCRCEN shouldbe set for memory copy. In 4-bit pixel mode, DSTEN must always be set aswell, so that a destination read is performed to avoid corrupting theother pixel. Note that using this method will be slower than otherwise.

The blitter 70 draws lines based on the well known digital differentialanalyzer (DDA) algorithm. The basis of this algorithm is that for agiven line one of the X address or the Y address is always incrementedfor every pixel drawn, while the other one is also incremented if asuitable arithmetic condition is met. The algorithm used by the blitter70 computes the arithmetic condition that causes the conditionalincrement by repeated subtraction of the smaller of dx or dy from aworking value with the larger being added back when underflow occurs,effectively using division to calculate the gradient. The notation "dx"refers to the distance along the X axis that the line corresponds to andis given by .linevert split.(X1-X2).linevert split. where X1 and X2 arethe X coordinates of the 2 points and the vertical bar notation meansthe magnitude or absolute value of their difference. Thus if a line isbeing drawn from (X1,Y1) to (X2,Y2), then dx=.linevertsplit.(X1-X2).linevert split. and dy=.linevert split.(Y1-Y2).linevertsplit.. From these, D1 (referred to as "delta one" above) is given bythe larger of dx and Dy, D2 (referred to as "delta two" above) by thesmaller. Then, for each pixel drawn, D2 is subtracted from a workingvalue which is initially set to D1/2 and the sign of the result of thissubtraction (indicating underflow) is the arithmetic condition for theconditional part of the screen address update. When this underflowoccurs, the original value of D1 is added back to the working value. Itcan be seen that the ratio of dx to dy will give the frequency withwhich of this underflow and adding back occurs. The ratio between themis of course the gradient of the line.

The values used to create a line draw are set in the blitter command asfollows: the starting point of the line is the destination address, D1is placed in bits 10 to 19 of the source address register and D1/2 isplaced in bits 0 to 9. D1 is also the inner counter value although D1plus 1 should be used if both end points of the line are to be drawn. D2is placed in the destination step register. If DX is greater than DY,then the YFRAC flag is set, otherwise it is cleared. SSIGN gives thesign of the X-address updates, DSIGN gives the sign of the Y-addressupdates.

While drawing lines, all the registers in the address section areoccupied in computing the line address; thus the blitter has no abilityto move data from somewhere else when drawing lines. Therefore, the datawritten at the line address has to be given either directly by thepattern data or by combination of the pattern register and the dataalready there, according to the logical function unit. Consequently,SRCEN should not be set, otherwise the blitter would produce seeminglyrandom data. While drawing lines the inner counter is set to the lengthof the line, and the outer counter is set to one. In 8 or more bits perpixel mode, DSTEN need not be set, unless used for read-modify-writeoperations. In 4-bits per pixel mode, DSTEN must always be set so that adestination read is performed to avoid corrupting the other pixel.

The blitter 70 also has the ability to paint characters on the screen ina single operation. Character painting as far as the blitter 70 isconcerned involves painting a rectangular area up to 8 pixels wide andof arbitrary height. The pixels in this area are either written to orleft unchanged according to a bit pattern. This mode is not restrictedto character painting, but may also be used to expand any graphicsstored as a monochrome bit plane.

During character paints, the source register addresses the bit pattern,normally part of the font, where each byte corresponds to one row of thecharacter. Thus, blitter fonts may be up to 8 pixels wide however, widerfonts may be used, but these will require more than 1 blitter paintoperation to paint a character. Character painting is essentially ablock move from the character font located in system memory 34 to thedestination address.

The data is arranged with the bit corresponding to the left-most pixelin the least significant bit, and the top of a character at the lowestaddress. If the data is less than 8 pixels wide, then the leastsignificant bits of the font data are not used.

The destination address register is used to address the area of thescreen to which the character is to be painted. Normally this area hasbeen cleared to the required background color by a previous blitteroperation. The destination address is initialized to the top left-handcorner of the character. The character to be painted is a rectangle,and, therefore, the destination address is programmed correspondingly.The inner counter is sent to the width of the character and the outercounter to its height. The destination step register is set to thescreen width less the width of the character. The DSTUP bit is used toallow the destination address to be updated between passes through theinner loop.

Inner loop control bits DSTEN and SRCENF are set, character paintingbeing the reason for the existence of SRCENF. This allows the font bytefor each row to be read just once. The comparator is used to control thepainting of pixels, therefore the CMPBIT control bit is set, to enableits bit to byte expansion mechanism.

The color to be painted is set as the pattern, and this will normally beheld in the pattern data register. In 4-bit pixel mode, DSTEN will beset, and the destination data register will hold the read values so thatthe other half of the byte may be written back undisturbed. The sourcedata register holds the font pattern, as mentioned above.

The blitter rotate and scaling mode uses the shading ALU, but instead ofproducing three DDA-based data values, it produces two DDA-based addressvalues, X and Y. Normally, these values are used to traverse a sourcedata field at arbitrary angles and rates so that the destination datacorresponds to a scaled and/or rotated version of them.

The red value generator gives the X value and the green value generatorgives the Y value. The blue value generator is not used, and clearlyshading cannot be used in conjunction with this mode. As the rotationrequires higher accuracy than shading, four extra integer bits are addedto the X and Y values. These are set up in rotate registers zero andone. All calculations are performed to 10 point bit accuracy.

As with shading, the delta values are added to X and Y after each pixelis drawn in the inner loop. The step values are added in the outer loop,and both the SRCUP and DSTUP flags must be set for them to be added. Thedelta and step values may be either positive or negative, and no add orsaturation occurs, unlike shading mode.

Normally, rotation and scaling are performed by setting the destinationaddress pointer to performing normal raster scan over the destinationrectangle, while the source pointer traverses over the source data at asuitable gradient and rate. This ensures that the destination data iscontiguous, and that no more blits (blitter operations) than necessaryare required. The source data should be surrounded with a suitabletransparent color if the target area is not rectangular.

A blitter command is given as a table of data in memory. The blitter 70loads the contents of the table into its registers and performs thespecified operation. The blitter 70 will receive successive sets ofcommands until a STOP instruction is read into the command register.

The blitter program address must be set up before the command word isissued. The blitter program address is given by the program addressregisters, which together form the full 24-bit address. The program mustlie on a word boundary.

A full table of blitter command data starts with a command word.However, the first blitter command in a sequence has its command wordwritten to the command register by an I/O cycle of the CPU 30; thus, theblitter command starts reading the command data from the second word.Similarly, the last blitter command need consist of no more than acommand word with the run bit clear.

A blitter command takes the form of numerous command bits and controlbits, a 24-bit source address, a 24-bit destination address, a 10-bitouter count value, a 10-bit inner count value, a 12-bit signed sourcestep, a 12-bit signed destination step, and a 15-bit pattern value. Ifthe SHADE bit is set, then 9 additional words are fetched: red, greenand blue initial values (6 integer bits and 10 fraction bits), red,green and blue delta values (same) and red, green and blue step values(same).

The command bits are as follows. Setting the RUN bit causes the blitter70 to start operation. It is used when writing to the command registeras an I/O port to start the blitter 70 reading a command. If the blitter70 loads a command with the RUN bit cleared as part of a command read,then operation ceases. Setting the COLST bit causes operation to stop ifa collision (write inhibit) occurs. From that point, print operation canbe resumed by the CPU 30 or aborted, and various internal registers maybe read. Setting the PARRD bit requires the blitter 70 to read a newparameter set from the program counter address, every time the innerloop exits and the outer loop has not reached zero. Setting the SRCUPbit requires the contents of the step register to be added to the sourceaddress on exit from the inner loop if the outer count has not reachedzero. Setting the DSTUP bit requires the contents of the step registerto be added to the destination address on exit from the inner loop ifthe outer count has not reached zero. Setting the SRCEN bit enables thesource address read in the inner loop. This also causes the sourceaddress register to be incremented according to the pixel size. Settingthe DSTEN bit enables a destination address read in the inner loop. Thisdoes not affect the destination address register, which is incrementedas part of the destination write cycle. Setting the SRCENF bit causesthe source address to be read when the inner loop is first entered, butnot subsequently entered. This is a special case of SRCEN and isrelevant to the character paint mode, as described above. SRCENF has noaffect if SRCEN is set. The two bits PSIZE0 and PSIZE1 select the pixelsize, 0 to 3 corresponding to 4, 8, 16, and 32 bits respectively. 32bits is for data moves in a 32-bit system only, as described above. The2-bits WIDTH0 and WIDTH1 select the screen width, in bytes, 0 to 3corresponding to 256, 512, 1024, and 2048 bytes, respectively. SettingLINDR puts the blitter 70 into line-drawing mode. This mode uses boththe source and destination address registers to generate the line-drawaddress, which may be used for both reading and writing. Setting theYFRAC bit indicates to the blitter 70 which of the X and Y addresseshave the fractional increment in line-drawing mode. It is set if the Yaddress has the fractional increment. Setting the PATSEL bit selects thepattern data register to replace the source data register as the sourceinput to the logical function unit. This bit is relevant to characterpainting, where the source data register will contain the font data, andthe pattern data register contains the ink color. Setting the shade bitenables output from the shading ALU as write data. This bit is onlyvalid for 8- and 16-bit pixels.

The blitter 70 has several types of control bits: source control bits,destination control bits, logic function unit control bits, andcomparator control bits. The blitter 70 has several source control bits.Setting the SWRAP bit causes source address updates to wrap on aprogrammable boundary, as opposed to running linearly through memory.Bits SWRAP0 and SWRAP1 control the size of the SWRAP function, whichmakes the source address pointer wrap vertically, with 0 to 3corresponding to 64K, 128K, 256K, and 512K screens, respectively.Setting the SRCCMP bit selects the source data register as the sourceinput to the comparator. If it is cleared, the pattern data register isused. Setting the SLWRAP register makes the source pointer wrap withinthe line width for inner loop updates. Setting the SSIGN bit sets thesign used when updating the source address. Setting it causes the sourceaddress to be decremented rather than incremented. This bit makes Xnegative in line-drawing.

The blitter 70 also has several destination control bits. Setting theDWRAP bit causes destination address updates to wrap on a programmableboundary, as opposed to running linearly through memory. Bits DWARP0 andDWRAP1 control the size of the DWRAP function, which makes the sourceaddress pointer wrap vertically, with 0 to 3 corresponding to 64K, 128K,256K, and 512K screens, respectively. Setting the DSTCMP bit selects thesource data register as the source input to the comparator. If it iscleared, the pattern data register is used. Setting the DLWRAP registermakes the source pointer wrap within the line width for inner loopupdates. Setting the DSIGN bit sets the sign used when updating thesource address. Setting it causes the source address to be decrementedrather than incremented. This bit makes Y negative in line-drawing.

The blitter 70 also has logic function unit control bits. The logicfunction unit controls the data that is written in a destination writecycle. The LFU allows any logical combination of the source anddestination data. This is achieved by each of the LFU bits LFU0 throughLFU3 selecting one of the minterms, with the output being given by thelogical OR of the selected terms. A 0 value corresponds to NOT sourceand NOT destination, 1 corresponds to NOT source and destination, 2corresponds to source and NOT destination, and 3 corresponds to sourceand destination. There are, therefore, sixteen possibilities.

The blitter 70 also has several comparator control bits. Setting CMPPLNenables plane mode where the three comparator functions operate on theplane number bits as opposed to the entire pixel. Setting the CMPEQ bitcauses the comparator to inhibit an inner loop write, if in plane modethe priority of the destination pixel is equal to the plane priority ofthe source pixel, or if the entire pixel is the same if not in planemode. Setting the CMPNE bit causes the comparator to inhibit an innerloop write, if in plane mode the priority of the destination pixel isnot equal to the plane priority of the source pixel, or if the entirepixel is not the same if not in plane mode. Setting the CMPGT bit onlyoperates in plane mode, and causes the comparator to inhibit the writeif the plane priority of the destination pixel is greater than the planepriority of the source pixel. Setting the CMPBIT gives a bit to byteexpansion scheme. It causes the comparator to generate an inhibit byselecting a bit of the source data register using an inner counter, andgenerating an inhibit if the bit selected is a zero. The selection isgiven by 8 in the inner counter selecting bit 0, 7 selecting bit 1, 6bit 2, and so on.

The program address register points to the source of blitting operationcommands. Data is read from it sequentially upwards through memory. Itmust always be even (i.e., blitter operations must lie on wordboundaries). Register 0 corresponds to address bits 0 through 15 andregister 1 to address bits 16 through 23 and bits 0 through 7.

Some of the above blitter registers are visible in the I/O space of theCPU 30. In addition, some blitter status and control bits are accessibleto the CPU 30. As mentioned above, the blitter 70 has 7 word-wide readregisters and 4 word-wide write registers. Any unused bits in the writeregister should be written with a 0. The I/O registers appear startingfrom I/O address 40H. These registers are also available in the memorymap, principally so the DSP 74 can access them, starting at the sameoffsets as I/O, but at base address F10400H (i.e., subtract 40H and addF10400H to get the memory address). The first blitter destinationregister corresponds to bits 0 through 15 of the destination addressregister. Bits 0 through 7 of the second blitter destination registercorrespond to bits 16 through 23 of the destination address register.And bit 15 of the second blitter destination register corresponds to thedestination address nibble part of the destination address register. Thefirst blitter source register corresponds to the bits 0 through 15 ofthe source address register. Bits 0 through 7 of the second blittersource register correspond to bits 16 through 23 of the source addressregister and bit 15 of the second blitter source register correspond tothe source address nibble part. Bits 0 through 9 of the blitter innercounter correspond to the inner counter value. Bits 0 through 9 of theblitter outer counter correspond to the outer counter value. The blitterstatus register gives a variety of blitter status information. Bit 0indicates that the comparator plane priority greater than condition ismet. Bit 1 indicates that the comparator plane priority equal conditionis met. Bit 2 indicates that the comparator plane priority not equalcondition is met. Bit 3 indicates that the comparator pixel equalcondition is met. Bit 4 indicates that the comparator pixel not equalcondition is met. Bit 5 indicates that the comparator bit to pixelcondition is met. Bit 13 corresponds to the run bit stating that theblitter is currently active, or operation is suspended by a CPUinterrupt or a collision stop. Bit 14 indicates that the blitter hasstopped for a CPU interrupt. Bit 15 indicates that the blitter hasstopped because of a collision detection. The blitter program addressregister is loaded with bits 0 through 15 of the blitter programaddress. Recall that bit 0 of the register is always 0 because blitterprograms must lie on word boundaries. The second blitter program addressregister is loaded with bits 16 through 23 of the blitter programaddress in bits 0 through 7. The other 8 bits are 0. The blitter commandregister corresponds to word 0 of the blitter command, and is used toset up the command when the blitter is started. Blitter DMA will thenstart from word one of the command.

The blitter control register has three bits: bit 0 which is an interruptstop mask masks interrupts from the blitter's bus control unit when set,with a result that the blitter will not stop when an interrupt occurs,bit 1 causes the blitter to resume operation after a collision and isused to restart the blitter after a collision has been detected. Recallthat a collision is detected when the COLST bit is set. The blitter willresume the operation which it has suspended. Note that it is possible toreprogram the blitter command register while the blitter is in thecollision stop state, so the COLST bit among others may be changed, andbit 2 resets the blitter to a quiescent state after collision and isused to abort the operation the blitter was performing when a collisionstop has occurred. Note that after a blitter collision stop occurs,either a resume or a reset should be issued to the blitter. The blitter70 also has three rotate registers. Bits 0 through 3 correspond to thetop four bits of the integer part of the X address, the bottom six bitsof the 10-bit value are the integer part of the red value. Bits 4through 7 correspond to the top four bits of the integer part of the Xincrement, the bottom six bits of this ten-bit value are the integerpart are the red integer value. Bits 8 through 11 correspond to the topfour bits of the integer part of the X step, the bottom six bits of thisten-bit value are the integer part are the red integer value. With thesecond rotate register bits 0 through 3 correspond to the top four bitsof the integer part of the Y address, the bottom six bits of thisten-bit value are the integer part are the green integer value. Bits 4through 7 correspond to the top four bits of the integer part of the Yincrement, the bottom six bits of the ten-bit value are the integer partof the green integer value. Bits 8 through 11 correspond to the top 4bits of the integer part of the Y step, the bottom six bits of theten-bit value are the integer part are the green integer value. In thethird rotate register setting bit 0 causes the rotate address to replacethe destination. Setting bit 1 causes the rotate address to replace thesource address. Setting bit 2 sets rotation mode, as opposed to shadingmode. And bits 10 through 15 correspond to the top bits of the rotateaddress.

The DSP 74 audio coprocessor is a general purpose arithmetic coprocessorwith sufficient power to implement a high performance music synthesizer.Synchronous serial outputs are provided for a generation of stereo audiosignals with 16 bit precision, giving a sound quality normallyassociated with compact disc technology. The DSP 74 ismicro-programmable from the host CPU 30 and the instruction set issufficiently flexible to enable the user to program the device tofulfill many different functions that are quite different from that of"music synthesizer." Such applications might include algorithmic speechgeneration, audio analysis using fast Fourier transform techniques, andthree-dimensional graphics rotations. The DSP 74 uses Harvardarchitecture (separate program and data buses) for maximum datathroughput. The DSP 74 has an arithmetic logic unit (ALU).

The ALU features a hardware 16-bit by 16-bit hardwaremultiply/accumulate as well as addition, subtraction, and logicalfunctions. There is also a separate serial divide unit, which generatesone quotient bit per tick. The carry bit from the adder/subtracter isstored in a separate latch and can be either used to propagate carry formultiple precision arithmetic operations or can be used for conditionalinstructions. All instructions may be made to be dependent on this bitbeing set. Data transfers within the device are all 16 bits wide, withthe exception of internal transactions within themultiplier/accumulator.

The DSP 74 is a very simple, very fast processor intended primarily forsound synthesis, but also capable of other computational tasks as notedabove. It executes all instructions in one processor cycle; theseinstructions are executed at the system clock speed (typically 20 to 33megahertz). During sound synthesis, the DSP 74 has its timing controlledby timers in an audio digital-to-analog converter (DAC) interface. TheseDACs are double-buffered, and if a DAC write is about to cause overflow,then operation is suspended until the buffer is empty. So long as thesoftware to executes loops at sample rate, and as long as the averageloop time is less than the sample period, then occasional loops can beup to twice as long. Because the loop may contain more instructions thanwill fit in the program RAM, the DSP 74 has an indexed addressing mode,which allows the same piece of code to act on several voices.

The DSP 74 is a Harvard Architecture device, thus the program RAM andthe data RAM are separate, with cycles occurring in both RAM blocks atthe same time. A one-cycle pipeline is used; therefore, during eachclock cycle two events occur: an instruction is fetched, and the datatransfer associated with the previous instruction takes place. This hasthe odd effect that an instruction after a jump is executed. The DSP 74has two arithmetic logic units (ALUs, not shown): a typical ALU and amultiply/accumulate ALU. several registers: an X operand register, asecond operand register, an AZ register, which holds the result from theALU, and an MZ register, which holds the result from themultiply/accumulate register. The DSP 74 also has a DMA channel and adivider.

Operation of the DSP 74 is fairly simple. In the first tick of anexecution of an instruction, the opcode is read from the program RAMinto the instruction decoder. In the second tick, while the nextinstruction is read from the program RAM, a data transfer is performedeither from system memory 34 to a register or a register to systemmemory 34, as per the first instruction.

The ALU within the DSP 74 is a 16-bit arithmetic logic unit, with thesame functions as a Texas Instruments 74181, which is well known in theart. Common arithmetic operations are encoded as instructions; uncommoninstructions may be performed by directly setting up the ALU mode bitswith the general purpose arithmetic instruction (GAI).

The DSP 74 also has a multiplier/accumulator, which is a second ALU toperform 16 by 16 signed/unsigned multiplies to yield a 32 bit result. Inaddition to this, it may also perform multiply/accumulate operations,where the product of the multiply is added to the previous result. Aresult is accumulated to 36 bits to allow for overflow. Multiplieroperations actually take two ticks, although the multiplying instructionitself completes in one tick. This means that the instruction followinga multiply or a multiply accumulate may not involve the MZ register orthe X register.

The DSP 74 also has a divider. The division unit appears as a set ofregisters in the internal DSP 74 space. It is capable of unsigneddivision on 16- or 32-bit operands, and produces a quotient and aremainder.

The DSP 74 also has a DMA channel. The DMA channel appears as a set ofregisters in the DSP 74 data memory space. These are two addressregisters and a data register. A DMA transfer is initiated by writing anaddress to the first of the two address registers. DMA transfers have alatency period, which must be allowed to elapse before performingfurther DMA. The DMA state machine is responsible for requesting theSYSTEM' bus 61, and when it is granted, performing the transfer, afterwhich the SYSTEM' bus 61 is released.

In the alternative, a word may be written to the second of the twoaddress registers with a hold bit set. This will request the SYSTEM' bus61 and retain it until the hold bit is cleared. Such a DMA transfer maybe efficient when performing successive multiple transfers, but isgenerally less efficient for single transfers because the DSP 74 programcannot determine when the SYSTEM' bus 61 is granted, and therefore hasto wait the maximum possible latency. DSP 74 memory is generally visiblein both the DSP's internal data address base and in the host addressbase.

The DSP 74 has a DSP memory 76 associated with it. The DSP memory 76comprises program RAM, data RAM, a register/constant table, and a sineROM (all not shown). The DSP memory 76 in general is accessible in boththe DSP's internal address space as well as the address space of thesystem memory 34. The DSP program RAM is 512 18-bit words. Theselocations may only be written by the CPU 30, and are program read-onlyas far as the DSP 74 is concerned. Program RAM does not appear in theDSP internal address space. The program RAM is not accessible to thehost when the DSP 74 is running. Each DSP instruction has a 7-bit opcodeand an 11-bit address vector. All microcoded instructions (with theexception of multiply or multiply/accumulate operations) are completedin 185 nanosecond cycle. All instructions are system memory 34 toregister transfers or register to register transfers; immediate valuesare not allowed. Thus, if a constant is needed for a given instruction,it is not available in the constant table, a data RAM location must beset aside for the value. The DSP 74 also allows conditional instructionsand indexed addressing. If bit 12 of the instruction code is set, thenthe instruction is executed only if the carry bit in the ALU is alsoset. If bit 11 in the instruction code is set, then the 9-bit addressvector in the instruction code is added to the 9-bit value in the indexregister to produce the address and data memory operated on by theinstruction. The extra two bits are programmed by loading the valuesinto an extra bits register then writing the word into the desiredlocation.

The DSP 74 has numerous move commands, which move data from and tomemory and registers. Several other commands are available, includingadding, subtracting, ANDing, ORing, adding with carry, a NOP, the GAIdescribed above, and an INTRUDE command, which allows the DSP memory 76to be accessed by the CPU 30.

The sine ROM is 256 16-bit words of full sine wave two's complement sinewave values.

The data RAM is 512 16-bit words.

Data may be transferred between the CPU 30 and the DSP 74 either undercontrol of the DSP 74 or under the control of the host CPU 30.

The DMA transfer mechanism is based upon the DSP 74 becoming the busmaster on the SYSTEM' bus 61 and accessing the system memory 34. The DSP74 is one of the highest priority bus masters, and will therefore begranted the SYSTEM' bus 61 by the current bus master as soon as thecurrent bus master is able to give up the SYSTEM' bus 61. The worst casefor giving up the SYSTEM' bus 61 is the situation where the CPU 30 isthe bus master, because the 80376 or 80386SX processor can take aconsiderable amount of time to release the SYSTEM' bus 61. DNA transfersare started by a write to the first DMA address register, as statedabove. Transfer of status information and the high part of the addressshould already have been written to the second DMA address register;similarly write data should already have been written to the DMA dataregister in the case of write transfers. When a transfer is initiated,the DSP 74 requests the SYSTEM' bus 61 and when the SYSTEM' bus 61 isgranted to the DSP 74, the DSP 74 performs the transfer and thenreleases the SYSTEM' bus 61. Completion of this operation may be polledor the programmer may choose to allow the maximum possible latency toelapse before using read data and/or initiating another transfer.

A second bus acquisition technique may be performed which uses the holdbit in the second of the two DMA address registers to request theSYSTEM' bus 61. This may be more efficient if the DSP 74 wishes toperform multiple transfers consecutively, because the SYSTEM' bus 61 isnot released between transfers. The hold bit in the second DMA addressregister must be cleared before the DSP 74 will release the SYSTEM' bus61. This mechanism is generally not recommended because the DSP 74 willhave control of the SYSTEM' bus 61 for significant periods of timewithout any activity, which is wasteful of overall memory bus bandwidthand could potentially disturb CD DMA transfers. If using the secondtechnique, the DSP 74 must first request the SYSTEM' bus 61 beforeperforming any DMA transfer. It has no means of detecting that it hasgained the SYSTEM' bus 61, and must therefore wait the maximum number ofbus instructions. Once the DSP 74 has acquired ownership of the SYSTEM'bus 61 it may then proceed to perform bus cycles. It may perform anarbitrary sequence of read and/or write cycles and should relinquishcontrol of the SYSTEM' bus 61 at the end of these.

Data transfer may also be performed between the CPU 30 and the DSP 74under host CPU 30 control. All the internal memory of the DSP 74 ismapped into the host address space. When the DSP 74 is in stop mode, thehost may write program memory locations just as if they were in normalsystem memory 34. When the DSP 74 is running, however, the programmemory is not available to the host. DSP 74 data memory is onlyavailable by the INTRUDE mechanism. To ensure that DSP 74 operations arenot disturbed in any way, data transactions can only take place in thedata when the DSP 74 is executing INTRUDE instructions. When the DSP 74is stopped, it may be considered to be effectively executing INTRUDEinstructions constantly.

CPU 30 to DSP program RAM 76 transfers may be performed using theblitter 70 only while the DSP 74 is not running. Likewise, the blitter70 cannot access DSP data RAM while the DSP 74 is executing. In short,both the blitter 70 and the CPU 30 may modify DSP program RAM 76 onlywhile the DSP 74 executes an INTRUDE instruction.

The DSP 74 can cause the blitter 70 to perform very fast block moves ofDSP code from system RAM to DSP program RAM. Thus, the DSP 74 andblitter 70 can team up to effectively provide the DSP 74 with moreprogram RAM than is actually available.

The DSP 74 also has a serial audio digital-to-analog convertor (DAC)interface. The serial DAC interface allows the DSP 74 to both drive asynchronous serial (I² S or similar) DAC, and to input data from asynchronous serial data source such as a CD drive. The interface timingcan be internally generated if no input device is attached, but if adata source is present, then it must be used to determine the timing. Aninternal overflow detector prevents the DSP 74 from writing to the DACbefore the previous output data has been fully output. This is governedby write to the first of two DAC registers. Therefore, DAC transfersshould take the form: write to the first DAC register, write to thesecond DAC register, read input values. These should be performed inclose succession (less than 16 instructions). There is no detection ofunderflow, and should this occur, then the previous output value will beoutput again. The DAC values are doubled buffered, so that althoughaudio code should loop at an average rate less than or equal to thesample period, it is possible for occasional passes through the loop totake up to two sample periods. This may be useful for exceptionprocessing.

The DSP 74 contains an arithmetic logic unit (ALU) compatible with theTexas Instruments 74181 device.

The A/V/CD controller/coprocessor 32 also has a compact disc DMAcontroller. This CD controller contains the following functional blocks:A simple synchronous serial interface (for I² S and similar) a CD ROMblock decoder and a DMA channel. The mechanism allows a serial datastream to be transferred to system memory 34, either directly, or byfirst passing through a block decoder. This allows an external blockdecoder to be used, in case of problems or incapabilities in theinternal one. An interrupt can be generated when a transfer completes,given the transfer length counter reaching zero.

The compact disc controller synchronous serial interface supports thePhilips data format, which is well known in the art. The Philips dataformat has a clock, a word select, line and a data line. The word selectleads the data by one tick of the clock, and the data is aligned againstthe most significant bit (MSB) of a 32-bit datum. A low on the wordselect line indicates left data and a high on the word select lineindicates right data. The synchronous serial interface also supports thePhilips block decoder output formula. The bit ordering is reversed, andthe first bit is aligned against the first bit of the datum. The wordselect format can be either the Philips data format, the Sony dataformat, or the Matsushita data format.

The CD drive controller 72 also has a block decoder. The block decodersynchronizes to the start of the 2352-byte sectors, performs thedescrambling, and computes the EDC (error detection code) to detecterrors. It operates in either short mode where a 2048 data bytes aretransferred after the header, or a long mode, where the 2340 bytes afterthe sync pattern are transferred. This allows the header and errorcorrection data to be read if desired. The header size is eitherprogrammable to either 4 or 12 bytes to support CD drive mode 1 andCDI/XA mode 2 form 1, but header matching is only performed on the main4-byte header. The mode 2 forms are only supported by operating in longmode and extracting the required data. Header matching is performed onthe first sector of the transfer to ensure that the correct data isbeing read. The desired header value should be programmed into theheader registers. If a multisector transfer is performed, then nofurther matching occurs after the first sector.

Typically, normal transfers are performed in short mode, with the longmode being used when an error has been detected, so that the operatingsoftware can attempt to correct it. Multiple sector transfers aresupported by giving a count of the total number of long words to betransferred. Errors will abort multiple sector transfers. Errors cantake the following forms: unreliable data, EDC error, and no sync. It ispossible to poll the decoder to determine its current status. The CDdrive controller also has a DMA interface. The DMA interface cantransfer to 2 16-bit words at a time into system memory 34. It can takeeither the output from the internal block decoder or the output from thesynchronous serial interface. It has an address counter that runsupwards through system memory 34. The DMA interface has a transferlength counter for direct transfer from the serial interface. In"forever mode" the DMA address register wraps within a 32 kilobytebuffer, and a counter is ignored. This may be useful for CD audio data,or for real time and data handling such as "full-motion video"decompression. A CPU 30 interrupt is generated every time the addresspointer wraps around the buffer.

Referring now to FIG. 5, an alternative way of "locking" a cartridge isshown. As stated above, the address scrambler 54 of FIGS. 1A and 3provides one way of "locking" program cartridges 14 against unauthorizeduse. Another method is to place a tone-generating microcontroller 100into the cartridge as shown in FIG. 5. The cartridge contains a programROM 50, which is described above in the text accompanying FIG. 1A, anaddress decoder 102, described in general in the text describing theaddress scrambler 54, and the microcontroller 100.

The address decoder is very similar to the address decoders found intypical cartridges, with the addition that the address decoder 102generates a chip select 57 signal to the program ROM 50 only when themicrocontroller 100 enables the address decoder 102 via an enable line103. The microcontroller 100 "locks" the cartridge 14 by disabling theaddress decoder 102.

The microcontroller 100 is in electrical circuit communication with theCPU 30 and the address decoder 102, as shown in FIG. 5. When the systemresets, the microcontroller 100 disables the address decoder 102,thereby "locking" the cartridge. The microcontroller 100 monitors theADDRESS bus 31b or another bus for an address or sequence of addresses.When the microcontroller 100 detects the proper sequence of addresses,it enables the address decoder 102, thereby "unlocking" the cartridge.

The microcontroller 100 acknowledges the proper sequence of addresses bygenerating a sequence of musical notes, which is heard by the user anddetected by the CPU 30. Any attempted key causes a tone to be producedby the microcontroller 100. The system unit can detect the tones in anyof several ways: discrete tone detection circuits (like a DTMF tonedecoder used in typical telephone circuits) can be used to detect thetones or the tone can be digitized with an A/D converter and analyzedwith an FFT algorithm to detect the generated tone signature. In thelatter case, the DSP 74 performs the analysis and communicates to theCPU 30 that the proper tone or set of tones was played, indicating thatthe cartridge is now unlocked.

Referring now to FIG. 6, a third alternative for "locking" a cartridgeis shown. The address scrambler 54 of FIGS. 1A and 3 and microcontroller100 of FIG. 5 provide two different ways of "locking" memory devicesusing hardware manipulation of address and data lines. However, not allmemory devices are interfaced to systems in such a way as to makeprotection of individual programs feasible with hardware. For example,some storage devices have a removable memory medium. Thus, a differenttype of method is required to "lock" memory devices without address anddata lines, such as a preprogrammed flexible diskette or a preprogrammedCD drive diskette. Such devices do not have address or data lines;therefore, they cannot be locked with an address scrambler or aselective locked chip select.

One technique of locking such devices is to make use of the fact thatthe system 10 of the present invention has both a CPU 30 and a DSP 74that have incompatible opcodes. That is, code compiled to execute on theCPU 30 will not directly execute on the DSP 74, and vice versa.

A locking device making use of the incompatible opcodes is shown in FIG.6. FIG. 6 shows a memory map 200 of a program ROM containing at leasttwo blocks of data: (1) a block of executable code capable of beingexecuted on the DSP 74 but not on the CPU 30 (BLOCK1 202 in FIG. 6) and(2) a block of code that is capable of executing on the CPU 30 that iscompressed or scrambled such that it cannot be executed on either theCPU 30 without first being decompressed or descrambled (BLOCK2 204 inFIG. 6). The two blocks of code can be placed into virtually any type ofmemory devices: program cartridges 14, or preprogrammed flexiblediskettes, or preprogrammed CD drive diskettes, for example.

The first block of code BLOCK1 202 is a small block of code executableon the DSP 74. It is a small program serving only four functions: (1)validating the presence of a memory device, (2) loading the second blockof data from the memory device into system RAM 34, (3) decompressing ordescrambling the second block of memory BLOCK2 204 into a formexecutable by the CPU 30, and (4) causing the CPU to execute thatexecutable code. Steps (2) and (3) can be performed in parallel byreading a small section of data, decompressing or descrambling it, andwriting the resultant code to memory.

The second block of code BLOCK2 204 is a larger block of applicationcode capable of execution in the CPU 30, except that the code has beencompressed or scrambled. Thus, as loaded into the second block BLOCK2204, the data cannot be executed by either the DSP 74 or the CPU 30.Placing the executable code into the well known run-length encoding(RLE) format is one method of compressing and scrambling the data in thesecond block of code BLOCK2 204. A way of merely scrambling the secondblock is to perform the well known picket fence cipher to the data,thereby swapping bytes of data in such a way that they may bedeciphered. Scrambling data could be as simple as swapping the upper andlower nibbles of a byte or as complicated as using any of the well knownencryption methods to make the code unreadable when accessed in thenormal sequential fashion. This is different than scrambling the addresslines, as described in the text above, to make a normal sequential codefetch break because an instruction is more than one byte long.

The entire second block of code BLOCK2 204 need not be compressed orscrambled; enough code must be compressed or scrambled to prevent theapplication from being executed by unauthorized devices. The remaininguncompressed and unscrambled data may be placed in optional BLOCK3 206.For example, graphical data need not be compressed. As another example,all subroutines need not be compressed if the high-level programexecutive is completely scrambled.

The system of FIGS. 1A and 1B is capable of unlocking the three blockcartridge described above. However, a system with a compatible CPU butwithout a compatible DSP is incapable of executing the application,because the CPU is unable to execute either block of code on the memorydevice: the first block BLOCK1 202 has opcodes that are totallyincompatible with the CPU 30 and the second block BLOCK2 204 has beencompressed or scrambled rendering it nonexecutable. Thus, the memorydevice is "locked."

The memory device is "unlocked" by the system of FIGS. 1A and 1B asfollows. First, the CPU 30 initializes the system 10 and checks for thepresence of a memory device, such as a CD drive 22. If a memory deviceis detected the CPU 30 loads the first block BLOCK1 202 from the memorydevice to system RAM 34. The CPU 30 then causes the DSP 74 to executethe code transferred from the memory device to system RAM 34. Executingthe first block of code BLOCK1 202 causes the DSP 74 to ensure that amemory device is present by, for example, performing a checksum on thedevice, copy the second block of memory BLOCK2 204 from the memorydevice to the system RAM 34, and decompress or descramble the secondblock of data BLOCK2 204 into a form executable on the CPU 30. Finally,the DSP 74 causes the CPU to execute the executable code transformedfrom the second block of data BLOCK2 204, thereby causing theapplication to start.

The advantage of this method is that no additional hardware is requiredin the memory device; one merely must put the first and second blocks ofdata into the memory device, as explained above. Thus, this two-blockmethod is suitable for program cartridges 14 as well as preprogrammedflexible diskettes and CD drive diskettes.

In the alternative, BLOCK2 204 might be executable, but in a form thatmust be loaded in a particular fashion. An example of such a form is anexecutable file in the well known .EXE form. Such a block of data isexecutable, but only when the executable portion is properly loaded intomemory. Implementing the lock entails placing a loader program intoBLOCK1 202, executable only on the DSP 74. The loader program accessesBLOCK2 204, loads it into memory 34, locates the executable portion, andpasses control to the CPU 30.

While the present invention has been illustrated by the description ofembodiments thereof, and while the embodiments have been described inconsiderable detail, it is not the intention of the applicant torestrict or in any way limit the scope of the appended claims to suchdetail. Additional advantages and modifications will readily appear tothose skilled in the art. For example, the address scrambler 54 of FIG.3 can be combined with the two-block locking method discussed above. Inaddition, the lock control circuit 56 of FIG. 1A can be combined withthe generic address decoder 102 of FIG. 5 without the need for thetone-producing microcontroller 100. Therefore, the invention in itsbroader aspects is not limited to the specific details, representativeapparatus and method, and illustrative examples shown and described.Accordingly, departures may be made from such details without departingfrom the spirit or scope of the applicant's general inventive concept.

I claim:
 1. A computer system comprising:(a) a central processing unit(CPU) in circuit communication with an audio/video/CD drivecontroller/co-processor (A/V/CD controller/co-processor) via a firstsystem bus, and (b) a system memory in circuit communication with saidA/V/CD controller/co-processor via a second system bus; and (c) saidA/V/CD controller/co-processor including an arbitrator for arbitratingcontrol over said second system bus, an integral memory interface, anintegral graphic processor, an integral digital signal processor, anintegral compact disk controller, and an integral video controller allin circuit communication with said CPU and said system memory and eachconfigured such that any one of said CPU, said graphics co-processor,said digital signal processor, said compact disk controller, and saidvideo controller may become bus master of said second system bus; (d) aninterrupt controller for interfacing interrupts to said CPU and saidarbitrator responsive to said interrupt controller such that said CPUdoes not have the highest priority for control over said second systembus until an interrupt occurs and is detected by said interruptcontroller; wherein said integral memory interfaces, said integralgraphics co-processor, said integral digital signal processor, saidintegral compact disk controller, and said integral video controller areelectrically connected within said A/V/CD controller/co-processor via aninternal bus such that said second system bus makes one bus connectionwith said A/V/CD controller/co-processor at said internal bus.
 2. Acomputer system according to claim 1 wherein said CPU has the lowestpriority for accessing said second system bus as compared to thepriority levels for said integral memory interface, said integralgraphics coprocessor, said integral digital signal processor, saidintegral compact disk controller, and said integral video controller. 3.A computer system according to claim 1 wherein said CPU has the lowestpriority for accessing said second system bus as compared to thepriority levels for said integral memory interface, said integralgraphics coprocessor, said integral digital signal processor, saidintegral compact disk controller, and said integral video controller,until an interrupt occurs, at which time said CPU has the highestpriority accessing said second system bus.
 4. A computer systemaccording to claim 1 wherein said integral graphics coprocessor of saidA/V/CD controller/coprocessor performs arbitrarily long sequences ofgraphics operations as a result of reading command sets from said systemmemory.
 5. A computer system according to claim 4 wherein commands forsaid integral graphics coprocessor of said A/V/CD controller/coprocessorare written by at least one of said CPU, said integral digital signalprocessor, and both said CPU and said integral digital signal processor.6. A computer system according to claim 1 wherein said integral graphicscoprocessor of said A/V/CD controller/coprocessor becomes bus master ofsaid second system bus while performing graphics operations, and deniessaid CPU any bus activity whatsoever on said second system bus whileperforming graphics operations.
 7. A computer system according to claim1 wherein said integral graphics coprocessor of said A/V/CDcontroller/coprocessor becomes bus master of said second system buswhile performing graphics operations, and denies said CPU any busactivity whatsoever on said second system bus, until an interruptoccurs.
 8. A computer system according to claim 7 wherein said integralgraphics coprocessor of said A/V/CD controller/coprocessor has asequencer having two loops, namely an outer command loop, during whichcommand loop commands are read from memory, and an inner parameter loopexecuting within command loops, during which parameter loop parametersare read from memory.
 9. A computer system according to claim 8 whereincommands for said integral graphics coprocessor of said A/V/CDcontroller/coprocessor are written by at least one of said CPU, saidintegral digital signal processor, and both said CPU and said integraldigital signal processor.
 10. A computer system according to claim 1wherein said integral graphics coprocessor of said A/V/CDcontroller/coprocessor becomes bus master of said second system buswhile performing graphics operations and remains bus master of saidsecond system bus, until at least one of said integral digital signalprocessor and said integral compact disk controller request access tosaid second system bus, or until an interrupt occurs.
 11. A computersystem according to claim 10 wherein said integral graphics coprocessorof said A/V/CD controller/coprocessor has a sequencer having two loops,namely an outer command loop, during which command loop commands areread from memory, and an inner parameter loop executing within commandloops, during which parameter loop parameters are read from memory. 12.A computer system according to claim 11 wherein commands for saidintegral graphics coprocessor of said A/V/CD controller/coprocessor arewritten by at least one of said CPU, said integral digital signalprocessor, and both said CPU and said integral digital signal processor.13. A computer system according to claim 1 wherein said integralgraphics coprocessor of said A/V/CD controller/coprocessor has asequencer having two loops, namely an outer command loop, during whichcommand loop commands are read from memory, and an inner parameter loopexecuting within command loops, during which parameter loop parametersare read from memory.
 14. A computer system according to claim 13wherein commands for said integral graphics coprocessor of said A/V/CDcontroller/coprocessor are written by at least one of said CPU, saidintegral digital signal processor, and both said CPU and said integraldigital signal processor.
 15. A computer system according to claim 1wherein said integral graphics coprocessor of said A/V/CDcontroller/coprocessor assigns a plane value to each pixel therebyallowing said integral graphics coprocessor to perform multiple planepixel operations.
 16. A computer system according to claim 1 whereinsaid integral video controller has a video interrupt register associatedtherewith, said video interrupt register storing therein a valuecorresponding to a particular line of video that causes an interrupteach time the particular line of video is generated.